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

Method CheckCleanWorkTree

src/Git/Git.cpp:2622–2657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2620}
2621
2622BOOL CGit::CheckCleanWorkTree(bool stagedOk /* false */)
2623{
2624 if (UsingLibGit2(GIT_CMD_CHECK_CLEAN_WT))
2625 {
2626 CAutoRepository repo(GetGitRepository());
2627 if (!repo)
2628 return FALSE;
2629
2630 if (git_repository_head_unborn(repo))
2631 return FALSE;
2632
2633 git_status_options statusopt = GIT_STATUS_OPTIONS_INIT;
2634 statusopt.show = stagedOk ? GIT_STATUS_SHOW_WORKDIR_ONLY : GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
2635 statusopt.flags = GIT_STATUS_OPT_UPDATE_INDEX | GIT_STATUS_OPT_EXCLUDE_SUBMODULES;
2636
2637 CAutoStatusList status;
2638 if (git_status_list_new(status.GetPointer(), repo, &statusopt))
2639 return FALSE;
2640
2641 return (0 == git_status_list_entrycount(status));
2642 }
2643
2644 if (Run(L"git.exe rev-parse --verify HEAD", nullptr, nullptr, CP_UTF8))
2645 return FALSE;
2646
2647 if (Run(L"git.exe update-index --ignore-submodules --refresh", nullptr, nullptr, CP_UTF8))
2648 return FALSE;
2649
2650 if (Run(L"git.exe diff-files --quiet --ignore-submodules", nullptr, nullptr, CP_UTF8))
2651 return FALSE;
2652
2653 if (!stagedOk && Run(L"git.exe diff-index --cached --quiet HEAD --ignore-submodules --", nullptr, nullptr, CP_UTF8))
2654 return FALSE;
2655
2656 return TRUE;
2657}
2658
2659BOOL CGit::IsResultingCommitBecomeEmpty(bool amend /* = false */)
2660{

Callers 9

TEST_PFunction · 0.80
CheckRebaseConditionMethod · 0.80
StartRebaseMethod · 0.80
OnBnClickedContinueMethod · 0.80
SVNDCommitMethod · 0.80
BisectStartMethod · 0.80
RevertSelectedCommitsMethod · 0.80
ContextMenuActionMethod · 0.80
ExecuteMethod · 0.80

Calls 1

GetPointerMethod · 0.45

Tested by 1

TEST_PFunction · 0.64