git-daemon: keep track of children
[git/git-svn.git] / git-tag-script
blob4124f5494a033c1bfddfbcce3c3e3d7da38797a5
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
10 tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
12 ( echo "#"
13 echo "# Write a tag message"
14 echo "#" ) > .editmsg
15 ${VISUAL:-${EDITOR:-vi}} .editmsg || exit
17 grep -v '^#' < .editmsg | git-stripspace > .tagmsg
19 [ -s .tagmsg ] || exit
21 ( echo -e "object $object\ntype $type\ntag $name\ntagger $tagger\n"; cat .tagmsg ) > .tmp-tag
22 rm -f .tmp-tag.asc .tagmsg
23 gpg -bsa .tmp-tag && cat .tmp-tag.asc >> .tmp-tag
24 mkdir -p "$GIT_DIR/refs/tags"
25 git-mktag < .tmp-tag > "$GIT_DIR/refs/tags/$name"
26 #rm .tmp-tag .tmp-tag.sig