Git development
 help / color / mirror / Atom feed
From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] git-verify-tag: detect wrong syntax
Date: Sun, 09 Oct 2005 20:12:56 +0200	[thread overview]
Message-ID: <20051009181256.17885.6626.stgit@zion.home.lan> (raw)
In-Reply-To: <20051009181246.17885.81654.stgit@zion.home.lan>

From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Print proper error messages when failing, and handle -h/--help to avoid, if
possible, to print double error message (from git-cat-file and from
git-verify-tag).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 git-verify-tag.sh |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/git-verify-tag.sh b/git-verify-tag.sh
--- a/git-verify-tag.sh
+++ b/git-verify-tag.sh
@@ -1,9 +1,16 @@
 #!/bin/sh
 . git-sh-setup || die "Not a git archive"
 
+usage() {
+	die "usage: git-verify-tag <tag>"
+}
+
+[ $# = 1 ] || usage
+[ "$1" = "-h" -o "$1" = "--help" ] && usage
+
 tag=$(git-rev-parse $1) || exit 1
 
-type=$(git-cat-file -t $tag) || exit 1
+type=$(git-cat-file -t $tag) || usage
 [ "$type" = "commit" ] && die "Light tag - verification impossible"
 [ "$type" = "tag" ] || die "Bad tag - SHA1 doesn't refer to a tag object nor to a commit one."
 

  reply	other threads:[~2005-10-09 18:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-09 18:12 [PATCH 1/2] Fix git-verify-tag for local tags Paolo 'Blaisorblade' Giarrusso
2005-10-09 18:12 ` Paolo 'Blaisorblade' Giarrusso [this message]
2005-10-09 19:29 ` Junio C Hamano

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=20051009181256.17885.6626.stgit@zion.home.lan \
    --to=blaisorblade@yahoo.it \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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