MCPcopy Create free account
hub / github.com/TortoiseGit/TortoiseGit / GetInitAddList

Method GetInitAddList

src/Git/Git.cpp:1363–1394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1361}
1362
1363int CGit::GetInitAddList(CTGitPathList& outputlist, bool getStagingStatus)
1364{
1365 BYTE_VECTOR cmdout;
1366
1367 outputlist.Clear();
1368 if (Run(L"git.exe ls-files -s -t -z", &cmdout))
1369 return -1;
1370
1371 if (outputlist.ParserFromLsFile(cmdout))
1372 return -1;
1373 for(int i = 0; i < outputlist.GetCount(); ++i)
1374 const_cast<CTGitPath&>(outputlist[i]).m_Action = CTGitPath::LOGACTIONS_ADDED;
1375
1376 if (getStagingStatus)
1377 {
1378 BYTE_VECTOR cmdunstagedout;
1379 for (int i = 0; i < outputlist.GetCount(); ++i)
1380 const_cast<CTGitPath&>(outputlist[i]).m_stagingStatus = CTGitPath::StagingStatus::TotallyStaged;
1381 if (Run(L"git.exe diff-files --raw --numstat -C -M -z --", &cmdunstagedout))
1382 return -1;
1383
1384 CTGitPathList unstaged;
1385 unstaged.ParserFromLog(cmdunstagedout);
1386 // File shows up both in the output of ls-files and diff-files: partially staged (typically modified after being added)
1387 for (int j = 0; j < unstaged.GetCount(); ++j)
1388 {
1389 CString path = unstaged[j].GetGitPathString();
1390 outputlist.UpdateStagingStatusFromPath(path, CTGitPath::StagingStatus::PartiallyStaged); // TODO: This is inefficient
1391 }
1392 }
1393 return 0;
1394}
1395
1396int CGit::GetSubmoduleHash(const CString& pathOfSubmodule, const CGitHash& revision, CGitHash& submoduleRevision, CString& err)
1397{

Callers 1

TEST_PFunction · 0.80

Calls 5

ParserFromLsFileMethod · 0.80
ClearMethod · 0.45
GetCountMethod · 0.45
ParserFromLogMethod · 0.45

Tested by 1

TEST_PFunction · 0.64