From: martin f. krafft Date: Thu, 20 Nov 2008 14:04:48 +0000 (+0100) Subject: Require an argument to tg -r X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=commitdiff_plain;h=c7692a249e6ed4cac8efd97279aee1023a6adf3b Require an argument to tg -r Right now, if -r is passed to tg, an ugly shift error occurs. This patch checks for that case and outputs the help message if it occurs. Signed-off-by: martin f. krafft Acked-by: Petr Baudis --- diff --git a/tg.sh b/tg.sh index 4dcc15e..afdcdda 100644 --- a/tg.sh +++ b/tg.sh @@ -261,7 +261,13 @@ setup_hook "pre-commit" [ -z "$tg__include" ] || return 0 if [ "$1" = "-r" ]; then - shift; base_remote="$1"; shift + shift + if [ -z "$1" ]; then + echo "Option -r requires an argument." >&2 + do_help + exit 1 + fi + base_remote="$1"; shift tg="$tg -r $base_remote" fi