From a14c85225b1db25ed490ec892b9eed09136354ae Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 11 Jun 2017 03:13:16 +0200 Subject: [PATCH] Make sure all code paths detect WC root as at least normal Signed-off-by: Sven Strickroth --- src/Git/GitStatus.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Git/GitStatus.cpp b/src/Git/GitStatus.cpp index 1e3fcb9b5..8de3433b7 100644 --- a/src/Git/GitStatus.cpp +++ b/src/Git/GitStatus.cpp @@ -72,11 +72,7 @@ git_wc_status_kind GitStatus::GetAllStatus(const CTGitPath& path, bool bIsRecurs if(isDir) { err = GetDirStatus(sProjectRoot, sSubPath, &statuskind, isfull, bIsRecursive, isfull); - // folders must not be displayed as added or deleted only as modified (this is for Shell Overlay-Modes) - if (statuskind == git_wc_status_unversioned && sSubPath.IsEmpty()) - statuskind = git_wc_status_normal; - else - AdjustFolderStatus(statuskind); + AdjustFolderStatus(statuskind); } else err = GetFileStatus(sProjectRoot, sSubPath, &statuskind, isfull, isfull, assumeValid, skipWorktree); @@ -517,6 +513,12 @@ int GitStatus::GetDirStatus(const CString& gitdir, const CString& subpath, git_w { if (!IsIgnore) { + // WC root is at least normal if there are no files added/deleted + if (subpath.IsEmpty()) + { + *status = git_wc_status_normal; + return 0; + } *status = git_wc_status_unversioned; return 0; } @@ -531,8 +533,8 @@ int GitStatus::GetDirStatus(const CString& gitdir, const CString& subpath, git_w g_HeadFileMap.CheckHeadAndUpdate(gitdir); SHARED_TREE_PTR treeptr = g_HeadFileMap.SafeGet(gitdir); - // Check init repository - if (treeptr->HeadIsEmpty() && path.IsEmpty()) + // WC root is at least normal if there are no files added/deleted + if (treeptr->empty() && path.IsEmpty()) *status = git_wc_status_normal; // check if only one file in repository is deleted in index else if (path.IsEmpty() && !treeptr->empty()) -- 2.11.4.GIT