summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-06-04 19:19:11 -0700
committerShawn O. Pearce <sop@google.com>2009-07-03 11:00:16 -0700
commit98ea26b8d842d11afe6326f026ba15644dc40770 (patch)
treee78cc2f8669d24d8c5078239d1aef3964da21c2b
parentc24c720b6135a8f7975bf9af265124eee2d464cb (diff)
downloadgit-repo-98ea26b8d842d11afe6326f026ba15644dc40770.tar.gz
Allow callers to reset the git config cache
If commands modify the git config too rapidly we might not notice the .git/config file has been modified, as they could run in the same filesystem timestamp window and thus not cause a change on the config's mtime. This can cause repo to miss re-reading the config file after running a command. Allowing the cache to be flushed forces us to re-read the config. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--git_config.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/git_config.py b/git_config.py
index e1e20463..2655939b 100644
--- a/git_config.py
+++ b/git_config.py
@@ -71,6 +71,14 @@ class GitConfig(object):
71 else: 71 else:
72 self._pickle = pickleFile 72 self._pickle = pickleFile
73 73
74 def ClearCache(self):
75 if os.path.exists(self._pickle):
76 os.remove(self._pickle)
77 self._cache_dict = None
78 self._section_dict = None
79 self._remotes = {}
80 self._branches = {}
81
74 def Has(self, name, include_defaults = True): 82 def Has(self, name, include_defaults = True):
75 """Return true if this configuration file has the key. 83 """Return true if this configuration file has the key.
76 """ 84 """