2 # Copyright (c) 2005 Linus Torvalds
4 USAGE
='-l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]'
14 while case "$#" in 0) break ;; esac
31 find tags
-type f
-print ;;
34 find tags
-type f
-print |
grep "$@" ;;
52 rm "$GIT_DIR/refs/tags/$tag_name" && \
53 echo "Deleted tag $tag_name."
68 if [ -e "$GIT_DIR/refs/tags/$name" -a -z "$force" ]; then
69 die
"tag '$name' already exists"
72 git-check-ref-format
"tags/$name" ||
73 die
"we do not like '$name' as a tag name."
75 object
=$
(git-rev-parse
--verify --default HEAD
"$@") ||
exit 1
76 type=$
(git-cat-file
-t $object) ||
exit 1
77 tagger
=$
(git-var GIT_COMMITTER_IDENT
) ||
exit 1
78 : ${username:=$(expr "z$tagger" : 'z\(.*>\)')}
80 trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
82 if [ "$annotate" ]; then
83 if [ -z "$message" ]; then
85 echo "# Write a tag message"
86 echo "#" ) > "$GIT_DIR"/TAG_EDITMSG
87 ${VISUAL:-${EDITOR:-vi}} "$GIT_DIR"/TAG_EDITMSG ||
exit
89 echo "$message" >"$GIT_DIR"/TAG_EDITMSG
92 grep -v '^#' <"$GIT_DIR"/TAG_EDITMSG |
93 git-stripspace
>"$GIT_DIR"/TAG_FINALMSG
95 [ -s "$GIT_DIR"/TAG_FINALMSG
] ||
{
96 echo >&2 "No tag message?"
100 ( printf 'object %s\ntype %s\ntag %s\ntagger %s\n\n' \
101 "$object" "$type" "$name" "$tagger";
102 cat "$GIT_DIR"/TAG_FINALMSG
) >"$GIT_DIR"/TAG_TMP
103 rm -f "$GIT_DIR"/TAG_TMP.asc
"$GIT_DIR"/TAG_FINALMSG
104 if [ "$signed" ]; then
105 gpg
-bsa -u "$username" "$GIT_DIR"/TAG_TMP
&&
106 cat "$GIT_DIR"/TAG_TMP.asc
>>"$GIT_DIR"/TAG_TMP ||
107 die
"failed to sign the tag with GPG."
109 object
=$
(git-mktag
< "$GIT_DIR"/TAG_TMP
)
112 leading
=`expr "refs/tags/$name" : '\(.*\)/'` &&
113 mkdir
-p "$GIT_DIR/$leading" &&
114 echo $object > "$GIT_DIR/refs/tags/$name"