Fix replacing of a directory with a file/symlink in git-checkout-cache
[git/jnareb-git.git] / git-tag-script
blob442a243575382a92f97d98efe44db37ab287e50c
1 #!/bin/sh
2 # Copyright (c) 2005 Linus Torvalds
4 . git-sh-setup-script || die "Not a git archive"
5 name="$1"
6 [ "$name" ] || die "I need a tag-name"
8 object=${2:-$(cat "$GIT_DIR"/HEAD)}
9 type=$(git-cat-file -t $object) || exit 1
11 ( echo "#"
12 echo "# Write a tag message"
13 echo "#" ) > .editmsg
14 ${VISUAL:-${EDITOR:-vi}} .editmsg || exit
16 grep -v '^#' < .editmsg | git-stripspace > .tagmsg
18 [ -s .tagmsg ] || exit
20 ( echo -e "object $object\ntype $type\ntag $name\n"; cat .tagmsg ) > .tmp-tag
21 rm -f .tmp-tag.asc .tagmsg
22 gpg -bsa .tmp-tag && cat .tmp-tag.asc >> .tmp-tag
23 git-mktag < .tmp-tag > "$GIT_DIR/refs/tags/$name"
24 #rm .tmp-tag .tmp-tag.sig