Git development
 help / color / mirror / Atom feed
From: "martin f. krafft" <madduck@debian.org>
To: git@vger.kernel.org, pasky@suse.cz
Cc: "martin f. krafft" <madduck@debian.org>
Subject: [TopGit PATCH] Require an argument to tg -r
Date: Thu, 20 Nov 2008 13:08:57 +0100	[thread overview]
Message-ID: <1227182937-25056-1-git-send-email-madduck@debian.org> (raw)

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 <madduck@debian.org>

---
 tg.sh |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/tg.sh b/tg.sh
index 4dcc15e..a5dc0a7 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
 
-- 
tg: (f17218e..) fixes/tg--r-require-arg (depends on: upstream)

                 reply	other threads:[~2008-11-20 12:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1227182937-25056-1-git-send-email-madduck@debian.org \
    --to=madduck@debian.org \
    --cc=git@vger.kernel.org \
    --cc=pasky@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox