mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-01-12 01:20:26 +00:00
Fix error parsing a non-existant configuration file
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>
This commit is contained in:
@@ -265,9 +265,11 @@ class GitConfig(object):
|
||||
This internal method populates the GitConfig cache.
|
||||
|
||||
"""
|
||||
d = self._do('--null', '--list').rstrip('\0')
|
||||
c = {}
|
||||
for line in d.split('\0'):
|
||||
d = self._do('--null', '--list')
|
||||
if d is None:
|
||||
return c
|
||||
for line in d.rstrip('\0').split('\0'):
|
||||
if '\n' in line:
|
||||
key, val = line.split('\n', 1)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user