Re: Git-commits mailing list feed.
- From
Junio C Hamano <junkio@cox.net>
- Date
- Apr 23, 2005, 18:54 UTC
- Message-ID
- <7voec52uk0.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.58.0504231125330.2344@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> I really want the resulting file to look like
LT> commit .... LT> tag ...
LT> here goes comment LT> here goes signature
LT> and no headers.
You can use --detach-sign with --armor, like this.
Signed-off-by: Junio C Hamano <junkio@cox.net> --- #!/bin/sh
sq=s/\'/\''\\'\'\'/g
usage="usage: $0 [--signer=...] commit-id tag < message"
while case "$#" in 0) break;; esac
do
case "$1" in
-s=*|--s=*|--si=*|--sig=*|--sign=*|--signe=*|--signer=*)
signer=`expr "$1" : '-[^=]*=\(.*\)'` ;;
-s|--s|--si|--sig|--sign|--signe|--signer)
case "$#" in 0 | 1) echo "$usage"; exit 1 ;; esac
signer="${2?}"
shift ;;
--)
shift
break ;;
-*)
echo "$usage"
exit 1 ;;
*)
break ;;
esac
shift
donecase "$#" in 2) echo >&2 "$usage"; exit 1 ;; esac commit="$1" tag="$2"
case "$signer" in '') signer_arg='' ;; ?*) signer_arg="--local-user '$(echo "$signer" | sed -e "$sq")'" ;; esac
tmp=.jit-tag.$$ trap 'rm -f $tmp-*' 0 1 2 3 15 tagblob=$tmp-tagblob tagsign=$tmp-tagsign
case $(cat-file -t "$commit" 2>/dev/null) in
commit) ;;
*) echo >&2 "$0: $commit is not a commit object"; exit 1 ;;
esac
{
echo "commit $commit"
echo "tag $tag"
case "$signer" in
'') ;;
?*) echo "signer $signer" ;;
esac
echo
tty -s && echo >&2 "Type your tag message and end with ^D."
cat
} >$tagblob || exit
gpgcmd="gpg $signer_arg -a --output $tagsign --detach-sign $tagblob"
eval "$gpgcmd" || exit
cat $tagblob $tagsign