Re: Git-commits mailing list feed.

From: Junio C Hamano
Date: Sat Apr 23 2005 - 13:59:47 EST


>>>>> "LT" == Linus Torvalds <torvalds@xxxxxxxx> 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@xxxxxxx>
---
#!/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
done

case "$#" 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/