From 5cffc195c97a24add62b755abcd2720f58949147 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Wed, 20 Oct 2021 21:27:58 +0000 Subject: [PATCH] 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 Commit-Queue: Gavin Mak --- recipes/recipe_modules/bot_update/resources/bot_update.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index 894cbcb8c2..17bd9e39bb 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -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