diff options
Diffstat (limited to 'git_config.py')
-rw-r--r-- | git_config.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/git_config.py b/git_config.py index fe983c4a..9dba699a 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 | """ |
@@ -254,9 +262,11 @@ class GitConfig(object): | |||
254 | finally: | 262 | finally: |
255 | fd.close() | 263 | fd.close() |
256 | except IOError: | 264 | except IOError: |
257 | os.remove(self._pickle) | 265 | if os.path.exists(self._pickle): |
266 | os.remove(self._pickle) | ||
258 | except cPickle.PickleError: | 267 | except cPickle.PickleError: |
259 | os.remove(self._pickle) | 268 | if os.path.exists(self._pickle): |
269 | os.remove(self._pickle) | ||
260 | 270 | ||
261 | def _ReadGit(self): | 271 | def _ReadGit(self): |
262 | """ | 272 | """ |