mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-01-12 01:20:26 +00:00
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>
This commit is contained in:
10
project.py
10
project.py
@@ -2572,6 +2572,16 @@ class Project:
|
|||||||
if os.path.exists(os.path.join(self.gitdir, "shallow")):
|
if os.path.exists(os.path.join(self.gitdir, "shallow")):
|
||||||
cmd.append("--depth=2147483647")
|
cmd.append("--depth=2147483647")
|
||||||
|
|
||||||
|
# Use clone-depth="1" as a heuristic for repositories containing
|
||||||
|
# large binaries and disable auto GC to prevent potential hangs.
|
||||||
|
# Check the configured depth because the `depth` argument might be None
|
||||||
|
# if REPO_ALLOW_SHALLOW=0 converted it to a partial clone.
|
||||||
|
effective_depth = (
|
||||||
|
self.clone_depth or self.manifest.manifestProject.depth
|
||||||
|
)
|
||||||
|
if effective_depth == 1:
|
||||||
|
cmd.append("--no-auto-gc")
|
||||||
|
|
||||||
if not verbose:
|
if not verbose:
|
||||||
cmd.append("--quiet")
|
cmd.append("--quiet")
|
||||||
if not quiet and sys.stdout.isatty():
|
if not quiet and sys.stdout.isatty():
|
||||||
|
|||||||
Reference in New Issue
Block a user