int CTGitPath::GetAdminDirMask() const { int status = 0; CString topdir; if (!GitAdminDir::HasAdminDir(GetWinPathString(), &topdir)) { return status; } // ITEMIS_INGIT will be revoked if necessary in TortoiseShell/ContextMenu.cpp status |= ITEMIS_INGIT|ITEMIS_INVERSIONEDFOLDER; if (IsDirectory()) { status |= ITEMIS_FOLDERINGIT; if (IsWCRoot()) { status |= ITEMIS_WCROOT; CString topProjectDir; if (GitAdminDir::HasAdminDir(GetWinPathString(), false, &topProjectDir)) { if (PathFileExists(topProjectDir + _T("\\.gitmodules"))) { CAutoConfig config(true); git_config_add_file_ondisk(config, CGit::GetGitPathStringA(topProjectDir + _T("\\.gitmodules")), GIT_CONFIG_LEVEL_APP, FALSE); CString relativePath = GetWinPathString().Mid(topProjectDir.GetLength()); relativePath.Replace(_T("\\"), _T("/")); relativePath.Trim(_T("/")); CStringA submodulePath = CUnicodeUtils::GetUTF8(relativePath); if (git_config_foreach_match(config, "submodule\\..*\\.path", [](const git_config_entry *entry, void *data) { return entry->value == *(CStringA *)data ? GIT_EUSER : 0; }, &submodulePath) == GIT_EUSER) status |= ITEMIS_SUBMODULE; } } } } CString dotGitPath; GitAdminDir::GetAdminDirPath(topdir, dotGitPath); if (PathFileExists(dotGitPath + _T("BISECT_START"))) status |= ITEMIS_BISECT; if (PathFileExists(dotGitPath + _T("MERGE_HEAD"))) status |= ITEMIS_MERGEACTIVE; if (PathFileExists(dotGitPath + _T("refs\\stash"))) status |= ITEMIS_STASH; if (PathFileExists(dotGitPath + _T("svn"))) status |= ITEMIS_GITSVN; if (PathFileExists(topdir + _T("\\.gitmodules"))) status |= ITEMIS_SUBMODULECONTAINER; return status; }
bool SVNAdminDir::IsWCRoot(const CString& path) const { if (PathIsUNCServer(path)) return false; return IsWCRoot(path, !!PathIsDirectory(path)); }