mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
[win-bootstrap] Log warning if reading global Git config fails
Logs a warning if reading the config fails. Still logs a warning for recommended settings, so the user can create their global config. Annoyingly, the exit code is the same for missing config file as it is for an existing but invalid file. Bug: b/382395049 Change-Id: I81113ff248f7a5eed2f9fd0303e0e81ae80d7d3e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6086756 Reviewed-by: Josip Sokcevic <sokcevic@chromium.org> Commit-Queue: Anne Redulla <aredulla@google.com>
This commit is contained in:
@@ -351,10 +351,9 @@ def get_git_global_config(git_path):
|
||||
last value for each multivar will be in the returned config.
|
||||
|
||||
Returns:
|
||||
- dict of the current global git config.
|
||||
|
||||
Raises:
|
||||
subprocess.CalledProcessError if there was an error reading the config.
|
||||
- GitConfigDict of the current global git config.
|
||||
- If there was an error reading the global git config (e.g. file doesn't
|
||||
exist, or is an invalid config), returns an empty GitConfigDict.
|
||||
"""
|
||||
try:
|
||||
# List all values in the global git config. Using the `-z` option allows
|
||||
@@ -366,7 +365,8 @@ def get_git_global_config(git_path):
|
||||
stdout=subprocess.PIPE,
|
||||
encoding='utf-8')
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise e
|
||||
logging.warning(f'Failed to read your global Git config:\n{e}\n')
|
||||
return GitConfigDict({})
|
||||
|
||||
# Process all entries in the config.
|
||||
config = {}
|
||||
|
||||
Reference in New Issue
Block a user