git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Fix git-verify-tag for local tags
@ 2005-10-09 18:12 Paolo 'Blaisorblade' Giarrusso
  2005-10-09 18:12 ` [PATCH 2/2] git-verify-tag: detect wrong syntax Paolo 'Blaisorblade' Giarrusso
  2005-10-09 19:29 ` [PATCH 1/2] Fix git-verify-tag for local tags Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-10-09 18:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

It currently exits printing "git-cat-file SHA1: bad file", while instead we must
just abort the verification for local tags (i.e. referring to commit objects).

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

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

diff --git a/git-verify-tag.sh b/git-verify-tag.sh
--- a/git-verify-tag.sh
+++ b/git-verify-tag.sh
@@ -3,6 +3,10 @@
 
 tag=$(git-rev-parse $1) || exit 1
 
+type=$(git-cat-file -t $tag) || exit 1
+[ "$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."
+
 git-cat-file tag $tag > .tmp-vtag || exit 1
 cat .tmp-vtag | sed '/-----BEGIN PGP/Q' | gpg --verify .tmp-vtag - || exit 1
 rm -f .tmp-vtag

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] git-verify-tag: detect wrong syntax
  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
  2005-10-09 19:29 ` [PATCH 1/2] Fix git-verify-tag for local tags Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-10-09 18:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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."
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Fix git-verify-tag for local tags
  2005-10-09 18:12 [PATCH 1/2] Fix git-verify-tag for local tags Paolo 'Blaisorblade' Giarrusso
  2005-10-09 18:12 ` [PATCH 2/2] git-verify-tag: detect wrong syntax Paolo 'Blaisorblade' Giarrusso
@ 2005-10-09 19:29 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2005-10-09 19:29 UTC (permalink / raw)
  To: git

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

> From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
>
> It currently exits printing "git-cat-file SHA1: bad file", while instead we must
> just abort the verification for local tags (i.e. referring to commit objects).

Good spotting, but checking for type being not a tag (not
limited to commit object) would be a better approach.  I'll fix
it up that way and apply (no need to resend).  Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-10-09 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-09 18:12 [PATCH 1/2] Fix git-verify-tag for local tags Paolo 'Blaisorblade' Giarrusso
2005-10-09 18:12 ` [PATCH 2/2] git-verify-tag: detect wrong syntax Paolo 'Blaisorblade' Giarrusso
2005-10-09 19:29 ` [PATCH 1/2] Fix git-verify-tag for local tags Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).