summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-07-02 16:12:57 -0700
committerShawn O. Pearce <sop@google.com>2009-07-02 16:12:57 -0700
commitc24c720b6135a8f7975bf9af265124eee2d464cb (patch)
treec1460ab9ad60850aed68b25ba6d98a931adc352e /git_config.py
parent2d1a3968971366fab7000664959a2d5a39b48996 (diff)
downloadgit-repo-c24c720b6135a8f7975bf9af265124eee2d464cb.tar.gz
Fix error parsing a non-existant configuration filev1.6.8.7
If a file (e.g. ~/.gitconfig) does not exist, we get None here rather than a string. NoneType lacks rstrip() so we cannot strip it. Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/git_config.py b/git_config.py
index e658b059..e1e20463 100644
--- a/git_config.py
+++ b/git_config.py
@@ -265,9 +265,11 @@ class GitConfig(object):
265 This internal method populates the GitConfig cache. 265 This internal method populates the GitConfig cache.
266 266
267 """ 267 """
268 d = self._do('--null', '--list').rstrip('\0')
269 c = {} 268 c = {}
270 for line in d.split('\0'): 269 d = self._do('--null', '--list')
270 if d is None:
271 return c
272 for line in d.rstrip('\0').split('\0'):
271 if '\n' in line: 273 if '\n' in line:
272 key, val = line.split('\n', 1) 274 key, val = line.split('\n', 1)
273 else: 275 else: