summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Mak <gavinmak@google.com>2025-12-15 18:49:13 +0000
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2025-12-15 11:32:49 -0800
commit5b0b5513d6fe009f4600399203b28490a38a7cf0 (patch)
tree6a1caafc086b06b0492038ccd76e3200946bf085
parentb5991d71283c0c3a5d31e371d34c4d976bde63fd (diff)
downloadgit-repo-5b0b5513d6fe009f4600399203b28490a38a7cf0.tar.gz
project: only use --no-auto-gc for git 2.23.0+
The flag for git fetch was introduced in git 2.23.0. Also skip the bloat check after sync if using an older version. Bug: 468589976 Bug: 379111283 Change-Id: Ib53e5494350c71a83906e5219d3a8c2b654e531f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/536082 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
-rw-r--r--project.py2
-rw-r--r--subcmds/sync.py6
2 files changed, 7 insertions, 1 deletions
diff --git a/project.py b/project.py
index a61c43ed5..8da2efc8e 100644
--- a/project.py
+++ b/project.py
@@ -2579,7 +2579,7 @@ class Project:
2579 effective_depth = ( 2579 effective_depth = (
2580 self.clone_depth or self.manifest.manifestProject.depth 2580 self.clone_depth or self.manifest.manifestProject.depth
2581 ) 2581 )
2582 if effective_depth == 1: 2582 if effective_depth == 1 and git_require((2, 23, 0)):
2583 cmd.append("--no-auto-gc") 2583 cmd.append("--no-auto-gc")
2584 2584
2585 if not verbose: 2585 if not verbose:
diff --git a/subcmds/sync.py b/subcmds/sync.py
index b7cb1732a..eb71ae92c 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -1437,6 +1437,12 @@ later is required to fix a server side protocol bug.
1437 run 'git count-objects -v' and warn if the repository is accumulating 1437 run 'git count-objects -v' and warn if the repository is accumulating
1438 excessive pack files or garbage. 1438 excessive pack files or garbage.
1439 """ 1439 """
1440 # We only care about bloated projects if we have a git version that
1441 # supports --no-auto-gc (2.23.0+) since what we use to disable auto-gc
1442 # in Project._RemoteFetch.
1443 if not git_require((2, 23, 0)):
1444 return
1445
1440 projects = [p for p in projects if p.clone_depth] 1446 projects = [p for p in projects if p.clone_depth]
1441 if not projects: 1447 if not projects:
1442 return 1448 return