2005-04-26 00:23:53 +02:00
|
|
|
#!/bin/sh
|
2005-05-10 07:57:58 +02:00
|
|
|
# Copyright (c) 2005 Linus Torvalds
|
|
|
|
|
2005-07-09 03:23:06 +02:00
|
|
|
. git-sh-setup-script || die "Not a git archive"
|
|
|
|
name="$1"
|
|
|
|
[ "$name" ] || die "I need a tag-name"
|
2005-05-10 07:57:58 +02:00
|
|
|
|
|
|
|
object=${2:-$(cat "$GIT_DIR"/HEAD)}
|
2005-04-30 01:25:05 +02:00
|
|
|
type=$(git-cat-file -t $object) || exit 1
|
2005-07-15 03:02:10 +02:00
|
|
|
tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
|
2005-07-09 03:23:06 +02:00
|
|
|
|
|
|
|
( echo "#"
|
|
|
|
echo "# Write a tag message"
|
|
|
|
echo "#" ) > .editmsg
|
|
|
|
${VISUAL:-${EDITOR:-vi}} .editmsg || exit
|
|
|
|
|
|
|
|
grep -v '^#' < .editmsg | git-stripspace > .tagmsg
|
|
|
|
|
|
|
|
[ -s .tagmsg ] || exit
|
|
|
|
|
2005-07-15 03:02:10 +02:00
|
|
|
( echo -e "object $object\ntype $type\ntag $name\ntagger $tagger\n"; cat .tagmsg ) > .tmp-tag
|
2005-07-09 03:23:06 +02:00
|
|
|
rm -f .tmp-tag.asc .tagmsg
|
2005-04-26 00:23:53 +02:00
|
|
|
gpg -bsa .tmp-tag && cat .tmp-tag.asc >> .tmp-tag
|
2005-07-15 03:00:15 +02:00
|
|
|
mkdir -p "$GIT_DIR/refs/tags"
|
2005-07-09 03:23:06 +02:00
|
|
|
git-mktag < .tmp-tag > "$GIT_DIR/refs/tags/$name"
|
2005-04-26 00:23:53 +02:00
|
|
|
#rm .tmp-tag .tmp-tag.sig
|