Revert "Reset origin/HEAD in git_cache if it points to master"

This reverts commit 63fea808b0.

Reason for revert: broke bot_update for dart, b/259380822

Original change's description:
> Reset origin/HEAD in git_cache if it points to master
>
> This change resets refs/remotes/origin/HEAD if it points to master. With the master to main migration going on with chromium repositories, some of the cached git repositories end up pointing to master instead of main. This change aids in fixing this issue.
>
> Bug: 1364030
> Change-Id: Ic181b0179daf7b2b842cff7f7187d94d9fb20007
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4029356
> Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

Bug: 1364030
Change-Id: I96842c15eba886f5b95cdd10f323b907d5ea165d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4030304
Reviewed-by: Gavin Mak <gavinmak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
changes/04/4030304/2
Alexander Thomas 3 years ago committed by LUCI CQ
parent 63fea808b0
commit ca3ebf119e

@ -439,15 +439,6 @@ class Mirror(object):
'Git cache has a lot of pack files (%d). Tried to re-bootstrap ' 'Git cache has a lot of pack files (%d). Tried to re-bootstrap '
'but failed. Continuing with non-optimized repository.' % 'but failed. Continuing with non-optimized repository.' %
len(pack_files)) len(pack_files))
else:
# Reset head when refs/remotes/origin/HEAD points to master.
# https://crbug.com/1364030
origin_head = subprocess.check_output(
[self.git_exe, 'symbolic-ref', 'refs/remotes/origin/HEAD'],
cwd=self.mirror_path).decode('utf-8', 'ignore').strip()
if origin_head.endswith('master'):
self.RunGit(['remote', 'set-head', '-a', 'origin'])
def _fetch(self, def _fetch(self,
rundir, rundir,

Loading…
Cancel
Save