summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorGavin Mak <gavinmak@google.com>2025-12-06 00:06:44 +0000
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2025-12-08 12:18:48 -0800
commit7f87c54043ce9a35a5bb60a09ee846f9d7070352 (patch)
tree2653c1705b063fca85bd3b65e90da64da52f112b /project.py
parent50c6226075258736c3e869242345a59ed7064da4 (diff)
downloadgit-repo-7f87c54043ce9a35a5bb60a09ee846f9d7070352.tar.gz
project: disable auto-gc on fetch for projects with clone-depth=1
This prevents GC hangs on repos with large binaries by skipping implicit GC during network fetch, using clone-depth=1 as a heuristic. Bug: 379111283 Change-Id: I977bf8cd521b11e37eba7ebc9f62120f2bbaf760 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/533802 Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/project.py b/project.py
index d90a53415..a61c43ed5 100644
--- a/project.py
+++ b/project.py
@@ -2572,6 +2572,16 @@ class Project:
2572 if os.path.exists(os.path.join(self.gitdir, "shallow")): 2572 if os.path.exists(os.path.join(self.gitdir, "shallow")):
2573 cmd.append("--depth=2147483647") 2573 cmd.append("--depth=2147483647")
2574 2574
2575 # Use clone-depth="1" as a heuristic for repositories containing
2576 # large binaries and disable auto GC to prevent potential hangs.
2577 # Check the configured depth because the `depth` argument might be None
2578 # if REPO_ALLOW_SHALLOW=0 converted it to a partial clone.
2579 effective_depth = (
2580 self.clone_depth or self.manifest.manifestProject.depth
2581 )
2582 if effective_depth == 1:
2583 cmd.append("--no-auto-gc")
2584
2575 if not verbose: 2585 if not verbose:
2576 cmd.append("--quiet") 2586 cmd.append("--quiet")
2577 if not quiet and sys.stdout.isatty(): 2587 if not quiet and sys.stdout.isatty():