summaryrefslogtreecommitdiff
path: root/git_config.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-09-28 15:59:40 -0400
committerMike Frysinger <vapier@google.com>2021-09-29 01:02:47 +0000
commitf88282ccc2f20e0f0498901a796eb82a5640daf9 (patch)
tree72c094254abb46f1f2d3b4c1ebcebfcd6fea8116 /git_config.py
parent8967a5aec621672ee7acab16aa37efcfa7435ea9 (diff)
downloadgit-repo-f88282ccc2f20e0f0498901a796eb82a5640daf9.tar.gz
git-repo-f88282ccc2f20e0f0498901a796eb82a5640daf9.zip
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>
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/git_config.py b/git_config.py
index bc70d1608..3cd093914 100644
--- a/git_config.py
+++ b/git_config.py
@@ -371,9 +371,10 @@ class GitConfig(object):
"""
c = {}
- d = self._do('--null', '--list')
- if d is None:
+ if not os.path.exists(self.file):
return c
+
+ d = self._do('--null', '--list')
for line in d.rstrip('\0').split('\0'):
if '\n' in line:
key, val = line.split('\n', 1)