sync: start clearing git settings that disabled pruning

For projects that no longer share their per-project objects directly, we
no longer have to disable the git settings that disable pruning.  See
commit "project: stop directly sharing objects/ between shared projects"
for more details.

Bug: https://crbug.com/gerrit/15553
Change-Id: Ica0e83c3002716424c2bc9111b3b3d3a76c30973
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/337535
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
This commit is contained in:
LaMont Jones 2022-05-20 10:35:04 +00:00
parent 355f4398d8
commit 48ea25c6a7

View File

@ -657,9 +657,15 @@ later is required to fix a server side protocol bug.
tidy_dirs = {} tidy_dirs = {}
for project in projects: for project in projects:
# Make sure pruning never kicks in with shared projects. # Make sure pruning never kicks in with shared projects that do not use
# alternates to avoid corruption.
if (not project.use_git_worktrees and if (not project.use_git_worktrees and
len(project.manifest.GetProjectsWithName(project.name, all_manifests=True)) > 1): len(project.manifest.GetProjectsWithName(project.name, all_manifests=True)) > 1):
if project.UseAlternates:
# Undo logic set by previous versions of repo.
project.config.SetString('extensions.preciousObjects', None)
project.config.SetString('gc.pruneExpire', None)
else:
if not opt.quiet: if not opt.quiet:
print('\r%s: Shared project %s found, disabling pruning.' % print('\r%s: Shared project %s found, disabling pruning.' %
(project.relpath, project.name)) (project.relpath, project.name))