mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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:
parent
355f4398d8
commit
48ea25c6a7
@ -657,21 +657,27 @@ 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 not opt.quiet:
|
if project.UseAlternates:
|
||||||
print('\r%s: Shared project %s found, disabling pruning.' %
|
# Undo logic set by previous versions of repo.
|
||||||
(project.relpath, project.name))
|
project.config.SetString('extensions.preciousObjects', None)
|
||||||
if git_require((2, 7, 0)):
|
project.config.SetString('gc.pruneExpire', None)
|
||||||
project.EnableRepositoryExtension('preciousObjects')
|
|
||||||
else:
|
else:
|
||||||
# This isn't perfect, but it's the best we can do with old git.
|
if not opt.quiet:
|
||||||
print('\r%s: WARNING: shared projects are unreliable when using old '
|
print('\r%s: Shared project %s found, disabling pruning.' %
|
||||||
'versions of git; please upgrade to git-2.7.0+.'
|
(project.relpath, project.name))
|
||||||
% (project.relpath,),
|
if git_require((2, 7, 0)):
|
||||||
file=sys.stderr)
|
project.EnableRepositoryExtension('preciousObjects')
|
||||||
project.config.SetString('gc.pruneExpire', 'never')
|
else:
|
||||||
|
# This isn't perfect, but it's the best we can do with old git.
|
||||||
|
print('\r%s: WARNING: shared projects are unreliable when using old '
|
||||||
|
'versions of git; please upgrade to git-2.7.0+.'
|
||||||
|
% (project.relpath,),
|
||||||
|
file=sys.stderr)
|
||||||
|
project.config.SetString('gc.pruneExpire', 'never')
|
||||||
project.config.SetString('gc.autoDetach', 'false')
|
project.config.SetString('gc.autoDetach', 'false')
|
||||||
# Only call git gc once per objdir, but call pack-refs for the remainder.
|
# Only call git gc once per objdir, but call pack-refs for the remainder.
|
||||||
if project.objdir not in tidy_dirs:
|
if project.objdir not in tidy_dirs:
|
||||||
|
Loading…
Reference in New Issue
Block a user