mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
git_config: update error handling with no config file
Now that _do throws an exception when `git` fails, update the logic that tries to read config files but the file doesn't exist. Bug: b/192664812 Change-Id: I6417ecd70891b8f2d5f2bdb819f91df69ac4b70c Test: `repo upload` no longer crashes when .repo/config doesn't exist Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/319295 Reviewed-by: Jack Neus <jackneus@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
8967a5aec6
commit
f88282ccc2
@ -371,9 +371,10 @@ class GitConfig(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
c = {}
|
c = {}
|
||||||
d = self._do('--null', '--list')
|
if not os.path.exists(self.file):
|
||||||
if d is None:
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
d = self._do('--null', '--list')
|
||||||
for line in d.rstrip('\0').split('\0'):
|
for line in d.rstrip('\0').split('\0'):
|
||||||
if '\n' in line:
|
if '\n' in line:
|
||||||
key, val = line.split('\n', 1)
|
key, val = line.split('\n', 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user