@matheusbsbs / matheus-bagliano / commits / 5a6850e8aa
Fork 0

Fix git-verify-tag for light-weight tags

It currently exits printing "git-cat-file SHA1: bad file", while instead we must just abort the verification for light-weight tags (e.g. referring to commit objects). [jc: tag objects can tag anything not just commits, so I fixed up the original patch slightly. you should be able to validate a signed tag that points at a blob object. ] Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Junio C Hamano <junkio@cox.net>

Paolo 'Blaisorblade' Giarrusso committed Oct 9, 2005 at 16:50 UTC 5a6850e8aae7c6ef4f22e07cb620eb9325543732
1 file changed +6 -2
git-verify-tag.sh
+6 -2
@@ -1,8 +1,12 @@
1 #!/bin/sh
2 . git-sh-setup || die "Not a git archive"
3
4 -tag=$(git-rev-parse $1) || exit 1
4 +type="$(git-cat-file -t "$1" 2>/dev/null)" ||
5 + die "$1: no such object."
6
6 -git-cat-file tag $tag > .tmp-vtag || exit 1
7 +test "$type" = tag ||
8 + die "$1: cannot verify a non-tag object of type $type."
9 +
10 +git-cat-file tag "$1" > .tmp-vtag || exit 1
11 cat .tmp-vtag | sed '/-----BEGIN PGP/Q' | gpg --verify .tmp-vtag - || exit 1
12 rm -f .tmp-vtag