sync: mark REPO_AUTO_GC=1 as deprecated.

REPO_AUTO_GC was introduced as a way for users to restore the previous
default behavior, since the default changed at the same time as the
option was added.  As such, it should be marked as deprecated, and
removed entirely in a future release.

Change-Id: Ib73d98fbea693e7057cc4587928c225a9e4beab2
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/353734
Reviewed-by: Sam Saccone <samccone@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
LaMont Jones 2022-12-01 20:18:46 +00:00
parent ea5239ddd9
commit d793553804

View File

@ -70,7 +70,9 @@ _ONE_DAY_S = 24 * 60 * 60
REPO_BACKUP_OBJECTS = 'REPO_BACKUP_OBJECTS' REPO_BACKUP_OBJECTS = 'REPO_BACKUP_OBJECTS'
_BACKUP_OBJECTS = os.environ.get(REPO_BACKUP_OBJECTS) != '0' _BACKUP_OBJECTS = os.environ.get(REPO_BACKUP_OBJECTS) != '0'
# Env var to implicitly turn auto-gc back on. # Env var to implicitly turn auto-gc back on. This was added to allow a user to
# revert a change in default behavior in v2.29.9, and will be removed in a
# future release.
_REPO_AUTO_GC = 'REPO_AUTO_GC' _REPO_AUTO_GC = 'REPO_AUTO_GC'
_AUTO_GC = os.environ.get(_REPO_AUTO_GC) == '1' _AUTO_GC = os.environ.get(_REPO_AUTO_GC) == '1'
@ -1226,6 +1228,8 @@ later is required to fix a server side protocol bug.
print(f"Will run `git gc --auto` because {_REPO_AUTO_GC} is set.", print(f"Will run `git gc --auto` because {_REPO_AUTO_GC} is set.",
file=sys.stderr) file=sys.stderr)
opt.auto_gc = True opt.auto_gc = True
print(f'{_REPO_AUTO_GC} is deprecated and will be removed in a future'
'release. Use `--auto-gc` instead.', file=sys.stderr)
def Execute(self, opt, args): def Execute(self, opt, args):
manifest = self.outer_manifest manifest = self.outer_manifest