summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--subcmds/sync.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 57ee0540..507d1c94 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -657,21 +657,27 @@ later is required to fix a server side protocol bug.
657 657
658 tidy_dirs = {} 658 tidy_dirs = {}
659 for project in projects: 659 for project in projects:
660 # Make sure pruning never kicks in with shared projects. 660 # Make sure pruning never kicks in with shared projects that do not use
661 # alternates to avoid corruption.
661 if (not project.use_git_worktrees and 662 if (not project.use_git_worktrees and
662 len(project.manifest.GetProjectsWithName(project.name, all_manifests=True)) > 1): 663 len(project.manifest.GetProjectsWithName(project.name, all_manifests=True)) > 1):
663 if not opt.quiet: 664 if project.UseAlternates:
664 print('\r%s: Shared project %s found, disabling pruning.' % 665 # Undo logic set by previous versions of repo.
665 (project.relpath, project.name)) 666 project.config.SetString('extensions.preciousObjects', None)
666 if git_require((2, 7, 0)): 667 project.config.SetString('gc.pruneExpire', None)
667 project.EnableRepositoryExtension('preciousObjects')
668 else: 668 else:
669 # This isn't perfect, but it's the best we can do with old git. 669 if not opt.quiet:
670 print('\r%s: WARNING: shared projects are unreliable when using old ' 670 print('\r%s: Shared project %s found, disabling pruning.' %
671 'versions of git; please upgrade to git-2.7.0+.' 671 (project.relpath, project.name))
672 % (project.relpath,), 672 if git_require((2, 7, 0)):
673 file=sys.stderr) 673 project.EnableRepositoryExtension('preciousObjects')
674 project.config.SetString('gc.pruneExpire', 'never') 674 else:
675 # This isn't perfect, but it's the best we can do with old git.
676 print('\r%s: WARNING: shared projects are unreliable when using old '
677 'versions of git; please upgrade to git-2.7.0+.'
678 % (project.relpath,),
679 file=sys.stderr)
680 project.config.SetString('gc.pruneExpire', 'never')
675 project.config.SetString('gc.autoDetach', 'false') 681 project.config.SetString('gc.autoDetach', 'false')
676 # Only call git gc once per objdir, but call pack-refs for the remainder. 682 # Only call git gc once per objdir, but call pack-refs for the remainder.
677 if project.objdir not in tidy_dirs: 683 if project.objdir not in tidy_dirs: