diff options
-rw-r--r-- | subcmds/sync.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 808df208..f41de8df 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -560,9 +560,20 @@ later is required to fix a server side protocol bug. | |||
560 | def _GCProjects(self, projects, opt, err_event): | 560 | def _GCProjects(self, projects, opt, err_event): |
561 | gc_gitdirs = {} | 561 | gc_gitdirs = {} |
562 | for project in projects: | 562 | for project in projects: |
563 | # Make sure pruning never kicks in with shared projects. | ||
563 | if len(project.manifest.GetProjectsWithName(project.name)) > 1: | 564 | if len(project.manifest.GetProjectsWithName(project.name)) > 1: |
564 | print('Shared project %s found, disabling pruning.' % project.name) | 565 | print('%s: Shared project %s found, disabling pruning.' % |
565 | project.bare_git.config('--replace-all', 'gc.pruneExpire', 'never') | 566 | (project.relpath, project.name)) |
567 | if git_require((2, 7, 0)): | ||
568 | project.config.SetString('core.repositoryFormatVersion', '1') | ||
569 | project.config.SetString('extensions.preciousObjects', 'true') | ||
570 | else: | ||
571 | # This isn't perfect, but it's the best we can do with old git. | ||
572 | print('%s: WARNING: shared projects are unreliable when using old ' | ||
573 | 'versions of git; please upgrade to git-2.7.0+.' | ||
574 | % (project.relpath,), | ||
575 | file=sys.stderr) | ||
576 | project.config.SetString('gc.pruneExpire', 'never') | ||
566 | gc_gitdirs[project.gitdir] = project.bare_git | 577 | gc_gitdirs[project.gitdir] = project.bare_git |
567 | 578 | ||
568 | has_dash_c = git_require((1, 7, 2)) | 579 | has_dash_c = git_require((1, 7, 2)) |