2 # Copyright (c) 2005 Linus Torvalds
4 . git-sh-setup-script || die "Not a git archive"
8 while case "$#" in 0) break ;; esac
25 [ "$name" ] || die "I need a tag-name"
26 [ -e "$GIT_DIR/refs/tags/$name" ] &&
27 [ "$force" ] || die "tag '$name' already exists"
30 object=$(git-rev-parse --verify --revs-only --default HEAD "$@") || exit 1
31 type=$(git-cat-file -t $object) || exit 1
32 tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
34 if [ "$signed" ]; then
36 echo "# Write a tag message"
38 ${VISUAL:-${EDITOR:-vi}} .editmsg || exit
40 grep -v '^#' < .editmsg | git-stripspace > .tagmsg
42 [ -s .tagmsg ] || exit
44 ( echo -e "object $object\ntype $type\ntag $name\ntagger $tagger\n"; cat .tagmsg ) > .tmp-tag
45 rm -f .tmp-tag.asc .tagmsg
46 gpg -bsa .tmp-tag && cat .tmp-tag.asc >> .tmp-tag
47 object=$(git-mktag < .tmp-tag)
48 rm -f .tmp-tag .tmp-tag.sig
51 mkdir -p "$GIT_DIR/refs/tags"
52 echo $object > "$GIT_DIR/refs/tags/$name"