4 # Copyright (c) Steve Hoelzer 2005
5 # Copyright (c) Petr Baudis 2006
7 # This command takes no arguments, and lists all tags in a given repository
8 # in alphabetical order, along with their corresponding SHA1 hash IDs.
12 # The first column contains flag letters. The 'S' flag means that the tag is
13 # GPG-signed, the '%' flag means that this is a "direct tag" (does not point
14 # to a tag object; this is now considered deprecated and you might have trouble
15 # distributing the tag to others). The '!' flag means that the tag is broken
16 # and points to a non-existing object.
18 # The second column shows the tag name, the third column its (abbreviated)
19 # object id and the fourth column the first line of tag description,
27 .
"${COGITO_LIB}"cg-Xlib ||
exit 1
29 msg_no_tags
="no tags present, please see cg-tag(1)"
31 [ -d "$_git/refs/tags" ] || die
"$msg_no_tags"
33 [ "$(find "$_git/refs
/tags
" -follow -type f)" ] \
36 maxlen
="$(git-for-each-ref --format="%(refname
)" refs/tags | column_width "refs
/tags
/")"
38 # %(content) and %(body) is broken for tags in git-1.4.4
40 git-for-each-ref
--format="%(refname) %(objectname) %(subject)" refs
/tags |
41 while read tag sha1 title
; do
43 name
="${tag#refs/tags/}"
45 type="$(git-cat-file -t "$sha1" 2>/dev/null)" || flag
="!"
46 if [ "$type" = "tag" ]; then
47 git-cat-file tag
"$sha1" |
grep -q '^-----BEGIN PGP SIGNATURE-----' && flag
="S"
48 elif [ "$type" ]; then
52 columns_print
"$flag " - "$name" $maxlen " ${sha1:0:12}~" - " $title" -