summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2009-06-28 15:09:16 -0700
committerDavid Aguilar <davvid@gmail.com>2009-06-29 00:24:36 -0700
commit438c54713a7ca56fba2a7985b6563aa076b17169 (patch)
treecdb2d8cfd5e05d3659f9b7bc9c5a5191d322df5f /git_config.py
parente020ebee4e3e4e2ddefd72d41ac0035e6d528725 (diff)
downloadgit-repo-438c54713a7ca56fba2a7985b6563aa076b17169.tar.gz
git_config: handle configuration entries with no values
A git-config entry with no value was preventing repo from initializing. This modifies _ReadGit() to handle config entries with empty values. Signed-off-by: David Aguilar <davvid@gmail.com> Reported-by: Josh Guilfoyle <jasta00@gmail.com>
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/git_config.py b/git_config.py
index a5b5b4d9..e658b059 100644
--- a/git_config.py
+++ b/git_config.py
@@ -259,21 +259,26 @@ class GitConfig(object):
259 os.remove(self._pickle) 259 os.remove(self._pickle)
260 260
261 def _ReadGit(self): 261 def _ReadGit(self):
262 d = self._do('--null', '--list') 262 """
263 c = {} 263 Read configuration data from git.
264 while d: 264
265 lf = d.index('\n') 265 This internal method populates the GitConfig cache.
266 nul = d.index('\0', lf + 1)
267 266
268 key = _key(d[0:lf]) 267 """
269 val = d[lf + 1:nul] 268 d = self._do('--null', '--list').rstrip('\0')
269 c = {}
270 for line in d.split('\0'):
271 if '\n' in line:
272 key, val = line.split('\n', 1)
273 else:
274 key = line
275 val = None
270 276
271 if key in c: 277 if key in c:
272 c[key].append(val) 278 c[key].append(val)
273 else: 279 else:
274 c[key] = [val] 280 c[key] = [val]
275 281
276 d = d[nul + 1:]
277 return c 282 return c
278 283
279 def _do(self, *args): 284 def _do(self, *args):