mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-10-20 20:28:25 +00:00
sync: skip the bloat check for projects without a worktree
Skip shallow clone bloat checks during --network-only syncs and filter out projects whose worktree directory does not exist on disk. Also return None quietly from _GetStatusSnapshot() when a project lacks an existing worktree directory. Bug: 565047698 Change-Id: Ia4c7db36a2bd78bc89e7b72f7a492b901b50efa7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/634425 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Brian Gan <brgan@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
This commit is contained in:
1 parent
310c99571f
commit
175198b0aa
4 files changed
+72
-6
No files matched your search
+12
-4
@@ -1608,9 +1608,6 @@ later is required to fix a server side protocol bug.
|
||||
"""
|
||||
project = cls.get_parallel_context()["projects"][project_index]
|
||||
|
||||
if not project.Exists or not project.worktree:
|
||||
return None
|
||||
|
||||
# Only check dirty or locally modified projects. These can't be
|
||||
# freshly cloned and will accumulate garbage.
|
||||
try:
|
||||
@@ -1660,16 +1657,27 @@ later is required to fix a server side protocol bug.
|
||||
run 'git count-objects -v' and warn if the repository is accumulating
|
||||
excessive pack files or garbage.
|
||||
"""
|
||||
# --network-only promises not to touch worktrees, but git status and
|
||||
# update-index --refresh can both rewrite the index.
|
||||
if opt.network_only:
|
||||
return
|
||||
|
||||
# We only care about bloated projects if we have a git version that
|
||||
# supports --no-auto-gc (2.23.0+) since what we use to disable auto-gc
|
||||
# in Project._RemoteFetch.
|
||||
if not git_require((2, 23, 0)):
|
||||
return
|
||||
|
||||
# Skip projects with no worktree on disk, e.g. ones only ever synced
|
||||
# with --network-only.
|
||||
projects = [
|
||||
p
|
||||
for p in projects
|
||||
if p.clone_depth and not p.stateless_prune_needed
|
||||
if p.clone_depth
|
||||
and not p.stateless_prune_needed
|
||||
and p.worktree
|
||||
and p.Exists
|
||||
and platform_utils.isdir(p.worktree)
|
||||
]
|
||||
if not projects:
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user