From 6f896d0bfc2771d133dfbe8623651a8e00c5ada1 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Mon, 9 Aug 2021 23:29:37 +0000 Subject: [PATCH] Set main as default branch for git_cache Currently, git cache depends on the global default branch. Set it to main explicitly instead. Bug: 3082645, b/195975120 Change-Id: Ia9331d479dbe9547b6913c74bbf86852fff3a596 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3083251 Auto-Submit: Josip Sokcevic Reviewed-by: Anthony Polito Commit-Queue: Anthony Polito --- git_cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git_cache.py b/git_cache.py index 9a4bed9ce..9c21067c5 100755 --- a/git_cache.py +++ b/git_cache.py @@ -302,7 +302,7 @@ class Mirror(object): try: # create new temporary directory locally tempdir = tempfile.mkdtemp(prefix='_cache_tmp', dir=self.GetCachePath()) - self.RunGit(['init', '--bare'], cwd=tempdir) + self.RunGit(['init', '--bare', '-b', 'main'], cwd=tempdir) self.print('Downloading files in %s/* into %s.' % (latest_dir, tempdir)) with self.print_duration_of('download'): @@ -410,7 +410,7 @@ class Mirror(object): # 1. No previous cache. # 2. Project doesn't have a bootstrap folder. # Start with a bare git dir. - self.RunGit(['init', '--bare'], cwd=self.mirror_path) + self.RunGit(['init', '--bare', '-b', 'main'], cwd=self.mirror_path) else: # Bootstrap failed, previous cache exists; warn and continue. logging.warning(