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

Method GetStatusForPathInternal

src/TGitCache/GITStatusCache.cpp:514–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512}
513
514CStatusCacheEntry CGitStatusCache::GetStatusForPathInternal(const CTGitPath& path, bool bRecursive)
515{
516 if (IsPathGood(path))
517 {
518 // Stop the crawler starting on a new folder while we're doing this much more important task...
519 // Please note, that this may be a second "lock" used concurrently to the one in RemoveCacheForPath().
520 CCrawlInhibitor crawlInhibit(&m_folderCrawler);
521
522 CTGitPath dirpath = path.GetContainingDirectory();
523 if ((dirpath.IsEmpty()) || (!m_shellCache.IsPathAllowed(dirpath.GetWinPath())))
524 dirpath = path.GetDirectory();
525 CCachedDirectory * cachedDir = GetDirectoryCacheEntry(dirpath);
526 if (cachedDir)
527 {
528 //CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": GetStatusForMember %d\n", bFetch);
529 return cachedDir->GetStatusForMember(path, bRecursive, false);
530 }
531 }
532 else
533 {
534 // path is blocked for some reason: return the cached status if we have one
535 // we do here only a cache search, absolutely no disk access is allowed!
536 auto cachedDir = GetDirectoryCacheEntryNoCreate(path.GetDirectory());
537 if (cachedDir)
538 {
539 if (path.IsDirectory())
540 return cachedDir->GetOwnStatus(false);
541 else
542 {
543 // We've found this directory in the cache
544 return cachedDir->GetCacheStatusForMember(path);
545 }
546 }
547 }
548 CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": ignored no good path %s\n", path.GetWinPath());
549 CStatusCacheEntry status;
550 if (m_shellCache.ShowExcludedAsNormal() && path.IsDirectory() && m_shellCache.HasGITAdminDir(path.GetWinPath(), true))
551 {
552 CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": force status %s\n", path.GetWinPath());
553 status.ForceStatus(git_wc_status_normal);
554 }
555 return status;
556}
557
558void CGitStatusCache::AddFolderForCrawling(const CTGitPath& path)
559{

Callers

nothing calls this directly

Calls 12

GetWinPathMethod · 0.80
GetDirectoryMethod · 0.80
GetStatusForMemberMethod · 0.80
GetOwnStatusMethod · 0.80
ShowExcludedAsNormalMethod · 0.80
HasGITAdminDirMethod · 0.80
ForceStatusMethod · 0.80
IsEmptyMethod · 0.45
IsPathAllowedMethod · 0.45
IsDirectoryMethod · 0.45

Tested by

no test coverage detected