From cc26143dc03ea3d99687bcfe8953fdc357d8b902 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 10 Mar 2018 14:22:18 -0800 Subject: [PATCH] projtool.pl: support gc --force --recompress Accept a new --recompress option to mean --no-reuse-object while running pack-objects (and accept that as a documented alias too). While unlikely that --no-reuse-object would be needed, make it more convenient to use it without needing to drop down to running gc.sh directly to make it happen. Also document that --no-reuse-delta is an alias for --redelta. Signed-off-by: Kyle J. McKay --- toolbox/projtool.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/toolbox/projtool.pl b/toolbox/projtool.pl index 1ca6699..4e09556 100755 --- a/toolbox/projtool.pl +++ b/toolbox/projtool.pl @@ -105,13 +105,15 @@ Usage: %s [--quiet] checkpw check project password for a match (prompted) - gc [--force | --auto] [--redelta] + gc [--force | --auto] [--redelta | --recompress] run the gc.sh script on project with --auto let the gc.sh script decide what to do with --force cause a full gc to take place (force_gc=1) with neither --auto nor --force do a mini or if needed a full gc (in other words just touch .needsgc and run gc.sh) 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) unless the global --quiet option is given show_progress=1 is used update [--force] [--quiet | --summary] @@ -1218,9 +1220,10 @@ sub cmd_checkpw { } sub cmd_gc { - my ($force, $auto, $redelta); + my ($force, $auto, $redelta, $recompress); parse_options(force => \$force, quiet => \$quiet, q => \$quiet, auto => \$auto, - redelta => \$redelta, "no-reuse-delta" => \$redelta, aggressive => \$force); + redelta => \$redelta, "no-reuse-delta" => \$redelta, aggressive => \$force, + recompress => \$recompress, "no-reuse-object" => $recompress); $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; @@ -1233,7 +1236,8 @@ sub cmd_gc { open NEEDSGC, '>', $project->{path}."/.needsgc" and close NEEDSGC; } my @args = ($Girocco::Config::basedir . "/jobd/gc.sh", $project->{name}); - $redelta and push(@args, "-f"); + $redelta && !$recompress and push(@args, "-f"); + $recompress and push(@args, "-F"); my $lastgc = $project->{lastgc}; system({$args[0]} @args) != 0 and return 1; # Do it again Sam, but only if lastgc was set, gc.sh succeeded and now it's not set -- 2.11.4.GIT