mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
sync: REPO_AUTO_GC=1 to restore old behavior.
Add an environment variable to restore previous behavior, since the older version of repo does not support `--auto-gc`. Change-Id: I874dfb8fc3533a97b8adfd52125eb3d1d75e2f3c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/351194 Reviewed-by: Sam Saccone <samccone@google.com> Tested-by: LaMont Jones <lamontjones@google.com>
This commit is contained in:
parent
24c6314fca
commit
5ed8c63942
@ -68,9 +68,12 @@ from manifest_xml import GitcManifest
|
||||
_ONE_DAY_S = 24 * 60 * 60
|
||||
# Env var to implicitly turn off object backups.
|
||||
REPO_BACKUP_OBJECTS = 'REPO_BACKUP_OBJECTS'
|
||||
|
||||
_BACKUP_OBJECTS = os.environ.get(REPO_BACKUP_OBJECTS) != '0'
|
||||
|
||||
# Env var to implicitly turn auto-gc back on.
|
||||
_REPO_AUTO_GC = 'REPO_AUTO_GC'
|
||||
_AUTO_GC = os.environ.get(_REPO_AUTO_GC) == '1'
|
||||
|
||||
|
||||
class _FetchOneResult(NamedTuple):
|
||||
"""_FetchOne return value.
|
||||
@ -312,7 +315,7 @@ later is required to fix a server side protocol bug.
|
||||
help='delete refs that no longer exist on the remote (default)')
|
||||
p.add_option('--no-prune', dest='prune', action='store_false',
|
||||
help='do not delete refs that no longer exist on the remote')
|
||||
p.add_option('--auto-gc', action='store_true',
|
||||
p.add_option('--auto-gc', action='store_true', default=None,
|
||||
help='run garbage collection on all synced projects')
|
||||
p.add_option('--no-auto-gc', dest='auto_gc', action='store_false',
|
||||
help='do not run garbage collection on any projects (default)')
|
||||
@ -1219,6 +1222,11 @@ later is required to fix a server side protocol bug.
|
||||
if opt.prune is None:
|
||||
opt.prune = True
|
||||
|
||||
if opt.auto_gc is None and _AUTO_GC:
|
||||
print(f"Will run `git gc --auto` because {_REPO_AUTO_GC} is set.",
|
||||
file=sys.stderr)
|
||||
opt.auto_gc = True
|
||||
|
||||
def Execute(self, opt, args):
|
||||
manifest = self.outer_manifest
|
||||
if not opt.outer_manifest:
|
||||
|
Loading…
Reference in New Issue
Block a user