From 32a801b5dadfd40ef7999339559413408555ebdc Mon Sep 17 00:00:00 2001 From: Robert Iannucci Date: Wed, 4 Dec 2019 22:05:12 +0000 Subject: [PATCH] [bot_update] Also bootstrap in the case that there are 0 pack files This can happen if the cache repo was init'd, but has no pack files; previously it would try to fetch from scratch. R=ehmaldonado@chromium.org, tandrii@chromium.org No-Presubmit: true Change-Id: I97e863dd6c2ecfd00fdb4238dda48e0d3929c4f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1941337 Commit-Queue: Robbie Iannucci Reviewed-by: Andrii Shyshkalov --- git_cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git_cache.py b/git_cache.py index c5f166e716..1782ec0937 100755 --- a/git_cache.py +++ b/git_cache.py @@ -486,11 +486,12 @@ class Mirror(object): pack_files = [] if os.path.isdir(pack_dir): pack_files = [f for f in os.listdir(pack_dir) if f.endswith('.pack')] - self.print('%s has %d .pack files, re-bootstrapping if >%d' % + self.print('%s has %d .pack files, re-bootstrapping if ==0 or >%d' % (self.mirror_path, len(pack_files), GC_AUTOPACKLIMIT)) should_bootstrap = (force or not self.exists() or + len(pack_files) == 0 or len(pack_files) > GC_AUTOPACKLIMIT) if not should_bootstrap: