Revert "Reset origin/HEAD when it points to master"

This reverts commit 19794fe91f.

Reason for revert: Doesn't fix the cache.

Original change's description:
> Reset origin/HEAD when it points to master
>
> This change tries resetting origin/HEAD when it points to master and the ref cannot be found. Post master->main migration, some cached repositories seem to point origin/HEAD to master.
>
> Bug: 1418866
> Change-Id: I83942901b105cace4d51deeac7e400f98d200168
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4296441
> Reviewed-by: Fumitoshi Ukai <ukai@google.com>
> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>

Bug: 1418866
Change-Id: I4c912f8401afb6fb0c2149c277778bdee9fa5d76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4304240
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
changes/40/4304240/2
Aravind Vasudevan 2 years ago committed by LUCI CQ
parent 30ebc0abc1
commit 214e1b269d

@ -735,19 +735,7 @@ def _git_checkout(sln, sln_dir, revisions, refs, no_fetch_tags, git_cache_dir,
# Note that the '--' argument is needed to ensure that git treats
# 'pin or branch' as revision or ref, and not as file/directory which
# happens to have the exact same name.
ref = pin or branch
try:
git('checkout', '--force', ref, '--', cwd=sln_dir)
except SubprocessFailed as e:
# TODO(crbug.com/1418866): master->main migration leaves some builders
# broken with outdated ref for origin/HEAD in cache. In this case,
# reset the ref and retry.
if ref != 'refs/remotes/origin/HEAD':
raise e
git('remote', 'set-head', '-a', 'origin', cwd=sln_dir)
git('checkout', '--force', ref, '--', cwd=sln_dir)
git('checkout', '--force', pin or branch, '--', cwd=sln_dir)
git('clean', '-dff', cwd=sln_dir)
return
except SubprocessFailed as e:

Loading…
Cancel
Save