From 02bfe00a412143237acf495f25f87f98b9f83d6a Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 7 Nov 2015 13:30:41 -0800 Subject: [PATCH] tg-tag.sh: support --quiet (aka -q) option The --quiet option suppresses the "Updated ..." message. Signed-off-by: Kyle J. McKay --- tg-tag.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tg-tag.sh b/tg-tag.sh index 0c27c56..3390f90 100644 --- a/tg-tag.sh +++ b/tg-tag.sh @@ -5,7 +5,7 @@ lf="$(printf '\n.')" && lf="${lf%?}" tab="$(printf '\t.')" && tab="${tab%?}" -USAGE="Usage: ${tgname:-tg} [...] tag [-s | -u ] [-f] [--no-edit] [-m | -F ] ( | --refs) [...]" +USAGE="Usage: ${tgname:-tg} [...] tag [-s | -u ] [-f] [-q] [--no-edit] [-m | -F ] ( | --refs) [...]" USAGE="$USAGE$lf Or: ${tgname:-tg} [...] tag (-g | --reflog) [--reflog-message] [--no-type] [-n | -number] []" usage() @@ -36,6 +36,7 @@ stash= reflogmsg= notype= setreflogmsg= +quiet= is_numeric() { @@ -55,6 +56,9 @@ while [ $# -gt 0 ]; do case "$1" in -h|--help) usage ;; + -q|--quiet) + quiet=1 + ;; -g|--reflog) reflog=1 ;; @@ -425,6 +429,7 @@ if [ -n "$logrefupdates" ]; then { >>"$git_dir/logs/$refname" || :; } 2>/dev/null fi if [ "$reftype" = "tag" -a -n "$signed" ]; then + [ -z "$quiet" ] || exec >/dev/null git tag -F "$git_dir/TGTAG_FINALMSG" ${signed:+-s} ${force:+-f} \ ${keyid:+-u} ${keyid} "$tagname" "$tagtarget" else @@ -454,6 +459,6 @@ else ;; esac git update-ref -m "$updmsg" "$refname" "$newtag" - [ -z "$old" ] || printf "Updated $reftype '%s' (was %s)\n" "$tagname" "$old" + [ -z "$old" -o -n "$quiet" ] || printf "Updated $reftype '%s' (was %s)\n" "$tagname" "$old" fi rm -f "$git_dir/TAG_EDITMSG" "$git_dir/TGTAG_FINALMSG" -- 2.11.4.GIT