From c21f76177e5f3ae6fe9115b3d6577855b5820876 Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Thu, 31 Jan 2013 22:58:24 +0800 Subject: [PATCH] Log cache can be disabled Signed-off-by: Sup Yut Sum --- src/TortoiseProc/GitLogCache.cpp | 8 ++++++++ src/TortoiseProc/gitlogcache.h | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/TortoiseProc/GitLogCache.cpp b/src/TortoiseProc/GitLogCache.cpp index 8c5744e2e..3658028bc 100644 --- a/src/TortoiseProc/GitLogCache.cpp +++ b/src/TortoiseProc/GitLogCache.cpp @@ -18,6 +18,7 @@ // #include "stdafx.h" #include "GitLogCache.h" +#include "registry.h" int static Compare(const void *p1, const void*p2) { @@ -34,6 +35,7 @@ CLogCache::CLogCache() m_DataFileMap = INVALID_HANDLE_VALUE; m_pCacheData = NULL; m_DataFileLength = 0; + m_bEnabled = CRegDWORD(_T("Software\\TortoiseGit\\EnableLogCache"), TRUE); } void CLogCache::CloseDataHandles() @@ -118,6 +120,9 @@ ULONGLONG CLogCache::GetOffset(CGitHash &hash,SLogCacheIndexFile *pData) int CLogCache::FetchCacheIndex(CString GitDir) { + if (!m_bEnabled) + return 0; + int ret=0; if (!g_GitAdminDir.GetAdminDirPath(GitDir, m_GitDir)) return -1; @@ -368,6 +373,9 @@ int CLogCache::RebuildCacheFile() } int CLogCache::SaveCache() { + if (!m_bEnabled) + return 0; + int ret =0; BOOL bIsRebuild=false; diff --git a/src/TortoiseProc/gitlogcache.h b/src/TortoiseProc/gitlogcache.h index 6ac969fe2..61f0e5efd 100644 --- a/src/TortoiseProc/gitlogcache.h +++ b/src/TortoiseProc/gitlogcache.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2012 - TortoiseGit +// Copyright (C) 2008-2013 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -96,6 +96,8 @@ class CLogCache public: protected: + BOOL m_bEnabled; + HANDLE m_IndexFile; HANDLE m_IndexFileMap; SLogCacheIndexFile *m_pCacheIndex; -- 2.11.4.GIT