git_cache: wrap "git remote show" call in retries

BUG=b:236709670
TEST=none

Change-Id: I575dd82260acdbeef3c4c7607e2c2ac8020a44c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3749247
Commit-Queue: Jack Neus <jackneus@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
changes/47/3749247/4
Jack Neus 3 years ago committed by LUCI CQ
parent bb07d9eb0b
commit 1601b3eba0

@ -423,9 +423,11 @@ class Mirror(object):
# Start with a bare git dir.
self.RunGit(['init', '--bare'], cwd=self.mirror_path)
# Set appropriate symbolic-ref
remote_info = subprocess.check_output(
[self.git_exe, 'remote', 'show', self.url],
cwd=self.mirror_path).decode('utf-8', 'ignore').strip()
remote_info = exponential_backoff_retry(
lambda: subprocess.check_output(
[self.git_exe, 'remote', 'show', self.url],
cwd=self.mirror_path).decode('utf-8', 'ignore').strip()
)
default_branch_regexp = re.compile(r'HEAD branch: (.*)$')
m = default_branch_regexp.search(remote_info, re.MULTILINE)
if m:

Loading…
Cancel
Save