From 59728efa17d2dc95010967b548b23d75bd6d5278 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 1 Jul 2021 17:09:11 -0700 Subject: [PATCH] projtool.pl: accept gc --aggressive for --force --redelta The standard `git gc` command accepts no options, `--auto` and `--aggressive` to activate various modes. By adding support for `--aggressive` it becomes a simple matter to translate the normal `git gc` command into the equivalent `projtool.pl gc` command without needing to exercise the gray matter. The equivalent of `git gc --aggressive` as far as `projtool.pl gc` is concerned is just `projtool.pl gc --force --redelta` which is already supported. Make `--aggressive` activate the `--force` and `--redelta` options. Since a plain `projtool.pl gc` already roughly corresponds to a plain `git gc` and a `projtool.pl gc --auto` already roughly corresponds to `git gc --auto` this change completes the trifecta. Signed-off-by: Kyle J. McKay --- toolbox/projtool.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/toolbox/projtool.pl b/toolbox/projtool.pl index a61d473..000e4c1 100755 --- a/toolbox/projtool.pl +++ b/toolbox/projtool.pl @@ -142,6 +142,7 @@ Usage: %s [...] with --redelta a full gc will use pack-objects --no-reuse-delta with --recompress a full gc uses pack-objects --no-reuse-object (--no-reuse-delta and --no-reuse-object are accepted as aliases) + with --aggressive activate the --force and --redelta options unless the global --quiet option is given show_progress=1 is used update [--force] [--quiet | --summary] @@ -1433,10 +1434,12 @@ sub cmd_checkpw { } sub cmd_gc { - my ($force, $auto, $redelta, $recompress); + my ($force, $auto, $redelta, $recompress, $aggressive); parse_options(force => \$force, quiet => \$quiet, q => \$quiet, auto => \$auto, redelta => \$redelta, "no-reuse-delta" => \$redelta, aggressive => \$force, - recompress => \$recompress, "no-reuse-object" => $recompress); + recompress => \$recompress, "no-reuse-object" => $recompress, + aggressive => \$aggressive); + $aggressive and $force = $redelta = 1; $force && $auto and die "--force and --auto are mutually exclusive options\n"; @ARGV or die "Please give project name on command line.\n"; @ARGV == 1 or die_usage; -- 2.11.4.GIT