Add unzip
[git/pclouds.git] / git-verify-tag.sh
blob37b0023b270928cd80e0a6456c3d34d8173c975b
1 #!/bin/sh
3 USAGE='<tag>'
4 SUBDIRECTORY_OK='Yes'
5 . git-sh-setup
7 verbose=
8 while case $# in 0) break;; esac
9 do
10 case "$1" in
11 -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
12 verbose=t ;;
14 break ;;
15 esac
16 shift
17 done
19 if [ "$#" != "1" ]
20 then
21 usage
24 type="$(git cat-file -t "$1" 2>/dev/null)" ||
25 die "$1: no such object."
27 test "$type" = tag ||
28 die "$1: cannot verify a non-tag object of type $type."
30 case "$verbose" in
32 git cat-file -p "$1" |
33 sed -n -e '/^-----BEGIN PGP SIGNATURE-----/q' -e p
35 esac
37 trap 'rm -f "$GIT_DIR/.tmp-vtag"' 0
39 git cat-file tag "$1" >"$GIT_DIR/.tmp-vtag" || exit 1
40 sed -n -e '
41 /^-----BEGIN PGP SIGNATURE-----$/q
43 ' <"$GIT_DIR/.tmp-vtag" |
44 gpg --verify "$GIT_DIR/.tmp-vtag" - || exit 1
45 rm -f "$GIT_DIR/.tmp-vtag"