From 10c775e358826f41e2d2ca76c655fba06cc5e90f Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Fri, 27 Jan 2012 17:41:25 +0100 Subject: [PATCH] optimize TGitCache for CLI operations w/o this ReadHash might read the old HEAD hash not the new one. Signed-off-by: Sven Strickroth --- src/TGitCache/DirectoryWatcher.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/TGitCache/DirectoryWatcher.cpp b/src/TGitCache/DirectoryWatcher.cpp index 46e831ae4..0725d1e76 100644 --- a/src/TGitCache/DirectoryWatcher.cpp +++ b/src/TGitCache/DirectoryWatcher.cpp @@ -401,14 +401,24 @@ void CDirectoryWatcher::WorkerThread() bool isIndex = false; if ((pFound = wcsstr(buf, L".git"))!=NULL) { - // omit repository data change except .git/index + // omit repository data change except .git/index.lock- or .git/HEAD.lock-files if ((ULONG_PTR)pnotify - (ULONG_PTR)pdi->m_Buffer > READ_DIR_CHANGE_BUFFER_SIZE) break; - if( wcsstr(pFound, L".git\\index") == NULL) + if ((wcsstr(pFound, L"index.lock") != NULL && wcsstr(pFound, L"HEAD.lock") != NULL) && pnotify->Action == FILE_ACTION_ADDED) + { + m_FolderCrawler->BlockPath(CTGitPath(buf).GetContainingDirectory().GetContainingDirectory()); // optimize here, and use general BlockPath with priorities continue; - else + } + else if ((wcsstr(pFound, L"index.lock") != NULL && wcsstr(pFound, L"HEAD.lock") != NULL) && pnotify->Action == FILE_ACTION_REMOVED) + { isIndex = true; + m_FolderCrawler->BlockPath(CTGitPath(buf).GetContainingDirectory().GetContainingDirectory(), 1); + } + else + { + continue; + } } path.SetFromWin(buf); -- 2.11.4.GIT