summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-05-21 18:52:49 -0700
committerShawn O. Pearce <sop@google.com>2009-05-29 09:31:00 -0700
commit1b34c9118ed86a15b0bc1094804c095dd7be33cb (patch)
treeed27e9a6636f99f1c8e917028c52bb060a52179a /git_config.py
parent366ad214b82cadc32920b371f7f99f3f6894ec6f (diff)
downloadgit-repo-1b34c9118ed86a15b0bc1094804c095dd7be33cb.tar.gz
Allow callers of GitConfig to specify the pickle file path
This way we can put it in another directory than the config file itself, e.g. hide it inside ".git" when parsing a ".gitmodules" file from the working tree. Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/git_config.py b/git_config.py
index bc7ed459..29d89797 100644
--- a/git_config.py
+++ b/git_config.py
@@ -56,16 +56,20 @@ class GitConfig(object):
56 return cls(file = os.path.join(gitdir, 'config'), 56 return cls(file = os.path.join(gitdir, 'config'),
57 defaults = defaults) 57 defaults = defaults)
58 58
59 def __init__(self, file, defaults=None): 59 def __init__(self, file, defaults=None, pickleFile=None):
60 self.file = file 60 self.file = file
61 self.defaults = defaults 61 self.defaults = defaults
62 self._cache_dict = None 62 self._cache_dict = None
63 self._section_dict = None 63 self._section_dict = None
64 self._remotes = {} 64 self._remotes = {}
65 self._branches = {} 65 self._branches = {}
66 self._pickle = os.path.join( 66
67 os.path.dirname(self.file), 67 if pickleFile is None:
68 '.repopickle_' + os.path.basename(self.file)) 68 self._pickle = os.path.join(
69 os.path.dirname(self.file),
70 '.repopickle_' + os.path.basename(self.file))
71 else:
72 self._pickle = pickleFile
69 73
70 def Has(self, name, include_defaults = True): 74 def Has(self, name, include_defaults = True):
71 """Return true if this configuration file has the key. 75 """Return true if this configuration file has the key.