Don't check refspecs when running git cat-file

bot_update fetches +refs/branch-heads/* but also checks git cat-file -e
+refs/branch-heads/* which fails.

Bug: 1261879
Change-Id: Ic902eebcb7301aeae32e1a8775e3babf9fdedea9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3234885
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
changes/85/3234885/3
Gavin Mak 4 years ago committed by LUCI CQ
parent 57f8581806
commit 5cffc195c9

@ -592,7 +592,11 @@ def _has_in_git_cache(revision_sha1, refs, git_cache_dir, url):
'cache', 'exists', '--quiet', '--cache-dir', git_cache_dir, url).strip()
if revision_sha1:
git('cat-file', '-e', revision_sha1, cwd=mirror_dir)
for ref in refs:
# Don't check refspecs.
filtered_refs = [
r for r in refs if r not in [BRANCH_HEADS_REFSPEC, TAGS_REFSPEC]
]
for ref in filtered_refs:
git('cat-file', '-e', ref, cwd=mirror_dir)
return True
except SubprocessFailed:
@ -637,7 +641,7 @@ def _set_git_config(fn):
with git_config_if_not_set('user.name', 'chrome-bot'), \
git_config_if_not_set('user.email', 'chrome-bot@chromium.org'), \
git_config_if_not_set('fetch.uriprotocols', 'https'):
return fn(*args, **kwargs)
return fn(*args, **kwargs)
return wrapper

Loading…
Cancel
Save