3 # Show information about given tag(s)
4 # Copyright (c) Petr Baudis 2006
6 # This command shows detailed information about specified tag(s).
10 USAGE
="cg-tag-show TAGNAME..."
13 .
"${COGITO_LIB}"cg-Xlib ||
exit 1
18 local tag
="$1" sha1
="$2"
19 local tagfile
="$(mktemp -t gittag.XXXXXX)"
21 git-cat-file tag
"$1" >"$tagfile" ||
return 1
22 cat "$tagfile" |
sed '/^-----BEGIN PGP SIGNATURE-----/Q' |
23 gpg
--verify "$tagfile" - ||
return 1
30 local tag
="$1" sha1
="$2" verify
="$3"
32 if [ "$verify" ]; then
33 if verify_tag
"$tag" "$sha1"; then
36 echo "Signature: NOT VERIFIED"
39 echo "Signature: None"
45 local tag
="$1" sha1
="$2" verify
="$3" object
= state
=1 date=
46 while IFS
=$
'\n' read -r line
; do
47 if [ ! "$line" -a "$state" = 1 ]; then
48 header_end
"$tag" "$sha1" "$verify"
54 if [ "$state" = 1 ]; then
57 object
) object
="$data";;
59 echo "Object: $object ($data)";;
61 if [ "$data" != "$tag" ]; then
62 echo "Real tag name: $data"
65 # We want wordsplitting in the $date here, to get
66 # TZ as separate argument.
68 showdate
${date[*]}; date="$_showdate"
69 echo "Tagger: ${data%%> *}> $date";;
71 echo " $line";; # print unknown headers as-they-are
73 elif [ "$state" = 2 ]; then
74 if [ x
"$line" = x
"-----BEGIN PGP SIGNATURE-----" ]; then
75 # FIXME: Extra newline was printed just before
81 if [ "$state" = 1 ]; then
82 header_end
"$tag" "$sha1" "$verify"
90 if ! sha1
="$(get_ref "refs
/tags
/$tag")"; then
91 echo "No such tag: $tag" >&2
95 local type="$(git-cat-file -t "$sha1" 2>/dev/null)"
96 if [ ! "$type" ]; then
97 echo "Broken tag: $tag" >&2
103 if [ "$type" != "tag" ]; then
105 echo "Object: $sha1 ($type)"
111 if git-cat-file tag
"$sha1" |
grep -q '^-----BEGIN PGP SIGNATURE-----'; then
114 git-cat-file tag
"$sha1" | cat_tag
"$tag" "$sha1" "$verify"
115 if [ ${PIPESTATUS[0]} -ne 0 -o ${PIPESTATUS[1]} -ne 0 ]; then
122 [ "${ARGS[0]}" ] || usage
126 for tag
in "${ARGS[@]}"; do
127 if [ "$first" ]; then
132 if ! show_tag
"$tag"; then