From 437b60f6bf046e32ad54af78e39a8d625dd900b5 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 31 Dec 2017 02:04:03 -0800 Subject: [PATCH] show_progress: make show_progress=0 show no progress Change the semantics of show_progress ever so slightly so that setting it to "0" means the same thing as leaving it unset or set to the empty string. It doesn't make sense to show progress when the setting is 0. Signed-off-by: Kyle J. McKay --- jobd/gc.sh | 4 ++-- shlib.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jobd/gc.sh b/jobd/gc.sh index 3e77ce4..98b7575 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -22,7 +22,7 @@ GIROCCO_SUPPRESS_AUTO_GC_UPDATE=1 && export GIROCCO_SUPPRESS_AUTO_GC_UPDATE # packing options packopts="--depth=50 --window=50 --window-memory=${var_window_memory:-1g}" -quiet=; [ -n "$show_progress" ] || quiet=-q +quiet="-q"; [ "${show_progress:-0}" = "0" ] || quiet= umask 002 [ "$cfg_permission_control" != "Hooks" ] || umask 000 @@ -1575,7 +1575,7 @@ if ! [ -e .nofetch ] && [ -n "$cfg_mirror" ]; then ( cd "$basedarcs.darcs" # without show_progress suppress non-error output - [ -n "$show_progress" ] || exec >/dev/null + [ "${show_progress:-0}" != "0" ] || exec >/dev/null # Note that this does not optimize _darcs/inventories/ :( darcs optimize || : ) diff --git a/shlib.sh b/shlib.sh index f68655f..86ee4f7 100644 --- a/shlib.sh +++ b/shlib.sh @@ -384,7 +384,7 @@ bang() { bang_active=1 bang_cmd="$*" bang_errcode=0 - if [ -n "$show_progress" ]; then + if [ "${show_progress:-0}" != "0" ]; then exec 3>&1 read -r bang_errcode <<-EOT || : $( @@ -419,7 +419,7 @@ bang_failed() { cat "$bang_log" >.banglog echo "" >>.banglog echo "$bang_cmd failed with error code $bang_errcode" >>.banglog - if [ -n "$show_progress" ]; then + if [ "${show_progress:-0}" != "0" ]; then echo "" echo "$bang_cmd failed with error code $bang_errcode" fi @@ -511,7 +511,7 @@ was_banged_message_sent() { # Progress report - if show_progress is set, shows the given message. progress() { - [ -z "$show_progress" ] || echo "$*" + [ "${show_progress:-0}" = "0" ] || echo "$*" } # Project config accessors; must be run in project directory -- 2.11.4.GIT