From e896393f975b5f48f5689c7a7a8a25f26f7e1ccb Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 7 Mar 2021 21:15:02 -0700 Subject: [PATCH] toolbox/update-all-config.pl: quiet means quiet Add missing checks for $quiet so that --quiet really means quiet rather than sorta, kinda quiet but not really. And might as well tidy up the calls to $progress -- it's not necessary to keep a counter if it's updated by 1 each time. Signed-off-by: Kyle J. McKay --- toolbox/update-all-config.pl | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/toolbox/update-all-config.pl b/toolbox/update-all-config.pl index 9e3fee3..625ffb5 100755 --- a/toolbox/update-all-config.pl +++ b/toolbox/update-all-config.pl @@ -139,7 +139,6 @@ sub main { my $bad = 0; $progress = Girocco::CLIUtil::Progress->new(scalar(@projects), "Updating config files"); - my $pcnt = 0; foreach (@projects) { my $projdir = "$root/$_.git"; if (! -d $projdir) { @@ -159,7 +158,7 @@ sub main { next; } process_one_project($_) or $bad = 1; - } continue {$progress->update(++$pcnt)} + } continue {$progress->update} $progress = undef; return $bad ? 1 : 0; @@ -354,9 +353,11 @@ sub process_one_project if (!defined($repovers)) { $repovers = ""; } elsif ($repovers =~ /^[2345]$/) { - pmsg($proj, "WARNING: unknown core.repositoryformatversion value left unchanged: \"$repovers\""); + pmsg($proj, "WARNING: unknown core.repositoryformatversion value left unchanged: \"$repovers\"") + unless $quiet; } elsif ($repovers !~ /^[01]$/) { - pmsg($proj, "WARNING: replacing invalid core.repositoryformatversion value: \"$repovers\"") unless $quiet; + pmsg($proj, "WARNING: replacing invalid core.repositoryformatversion value: \"$repovers\"") + unless $quiet; $repovers = ""; } &$do_config('core.repositoryformatversion', 0) if $repovers eq ""; @@ -382,7 +383,8 @@ sub process_one_project } my $cmplvl = defval($config->{'core.compression'},""); if ($cmplvl !~ /^-?\d+$/ || $cmplvl < -1 || $cmplvl > 9 || "" . (0 + $cmplvl) ne "" . $cmplvl) { - pmsg($proj, "WARNING: replacing invalid core.compression value: \"$cmplvl\"") unless $cmplvl eq "" || $quiet; + pmsg($proj, "WARNING: replacing invalid core.compression value: \"$cmplvl\"") + unless $cmplvl eq "" || $quiet; $cmplvl = ""; } elsif ($cmplvl != 5) { pmsg($proj, "WARNING: suboptimal core.compression value left unchanged: \"$cmplvl\"") unless $quiet; @@ -392,7 +394,7 @@ sub process_one_project if ($grpshr eq "" || (valid_bool($grpshr) && !git_bool($grpshr))) { &$do_config('core.sharedrepository', 1); } elsif (!(valid_bool($grpshr) && git_bool($grpshr))) { - pmsg($proj, "WARNING: odd core.sharedrepository value left unchanged: \"$grpshr\""); + pmsg($proj, "WARNING: odd core.sharedrepository value left unchanged: \"$grpshr\"") unless $quiet; } if (git_bool($config->{'core.bare'})) { my $setlaru = 1; @@ -512,7 +514,7 @@ sub do_mkdir } else { $result = "(dryrun)"; } - pmsg($proj, "$subdir/: created", $result); + pmsg($proj, "$subdir/: created", $result) unless $quiet; return $result ne "FAILED"; } @@ -534,7 +536,7 @@ sub check_dperm { } else { $result = "(dryrun)"; } - pmsg($proj, "$subdir/:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result); + pmsg($proj, "$subdir/:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result) unless $quiet; return $result ne "FAILED"; } @@ -556,7 +558,7 @@ sub change_dpermrwx { } else { $result = "(dryrun)"; } - pmsg($proj, "$subdir/:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result); + pmsg($proj, "$subdir/:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result) unless $quiet; return $result ne "FAILED"; } @@ -579,7 +581,7 @@ sub change_dpermrx { } else { $result = "(dryrun)"; } - pmsg($proj, "$subdir/:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result); + pmsg($proj, "$subdir/:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result) unless $quiet; return $result ne "FAILED"; } @@ -601,7 +603,7 @@ sub check_fperm { } else { $result = "(dryrun)"; } - pmsg($proj, "$file:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result); + pmsg($proj, "$file:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result) unless $quiet; return $result ne "FAILED"; } @@ -624,7 +626,7 @@ sub check_fpermr { } else { $result = "(dryrun)"; } - pmsg($proj, "$file:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result); + pmsg($proj, "$file:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result) unless $quiet; return $result ne "FAILED"; } @@ -647,7 +649,7 @@ sub check_fpermnox { } else { $result = "(dryrun)"; } - pmsg($proj, "$file:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result); + pmsg($proj, "$file:", get_mode_perm($oldmode), '->', get_mode_perm($newmode), $result) unless $quiet; return $result ne "FAILED"; } @@ -673,7 +675,7 @@ sub change_group { $result = "(dryrun)"; } my $isdir = ((($info[2] >> 12) & 017) == 004) ? '/' : ''; - pmsg($proj, "$item$isdir: group", get_grp_nam($info[5]), '->', get_grp_nam($grpid), $result); + pmsg($proj, "$item$isdir: group", get_grp_nam($info[5]), '->', get_grp_nam($grpid), $result) unless $quiet; return $result ne "FAILED"; } -- 2.11.4.GIT