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>
diff --git a/git_cache.py b/git_cache.py
index 21a7095..0c61285 100755
--- a/git_cache.py
+++ b/git_cache.py
@@ -423,9 +423,11 @@
         # 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: