git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Allow "-u" flag to tag signing
@ 2005-10-06 16:58 Linus Torvalds
  2005-10-06 17:15 ` H. Peter Anvin
  2005-10-06 23:32 ` Chris Wright
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Torvalds @ 2005-10-06 16:58 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


The current "git tag -s" thing always uses the tagger name as the signing 
user key, which is very irritating, since my key is under my email 
address, but the tagger key obviously contains the actual machine name 
too.

Now, I could just use "GIT_COMMITTER_EMAIL" and force it to be my real 
email, but I actually think that it's nice to see which machine I use for 
my work. 

So rather than force my tagger ID to have to match the gpg key name, just 
support the "-u" flag to "git tag" instead. It implicitly enables signing, 
since it doesn't make any sense without it. Thus:

	git tag -u <gpg-key-name> <tag-name> [<tagged-object>]

will use the named gpg key for signing.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
Not very well tested, but I re-did my v2.6.14-rc3 tag with this, since I'd 
messed up the comments (and called it v2.6.14-rc2 in there ;)

So it may even work.

diff --git a/git-tag.sh b/git-tag.sh
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -12,6 +12,7 @@ annotate=
 signed=
 force=
 message=
+username=
 while case "$#" in 0) break ;; esac
 do
     case "$1" in
@@ -30,6 +31,12 @@ do
 	shift
 	message="$1"
 	;;
+    -u)
+	annotate=1
+	signed=1
+	shift
+	username="$1"
+	;;
     -*)
         usage
 	;;
@@ -70,8 +77,11 @@ if [ "$annotate" ]; then
     ( echo -e "object $object\ntype $type\ntag $name\ntagger $tagger\n"; cat .tagmsg ) > .tmp-tag
     rm -f .tmp-tag.asc .tagmsg
     if [ "$signed" ]; then
-	me=$(expr "$tagger" : '\(.*>\)') &&
-	gpg -bsa -u "$me" .tmp-tag &&
+	{
+		[ "$username" ] ||
+		username=$(expr "$tagger" : '\(.*>\)')
+	} &&
+	gpg -bsa -u "$username" .tmp-tag &&
 	cat .tmp-tag.asc >>.tmp-tag ||
 	die "failed to sign the tag with GPG."
     fi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Allow "-u" flag to tag signing
  2005-10-06 16:58 Allow "-u" flag to tag signing Linus Torvalds
@ 2005-10-06 17:15 ` H. Peter Anvin
  2005-10-06 20:17   ` Junio C Hamano
  2005-10-06 23:32 ` Chris Wright
  1 sibling, 1 reply; 4+ messages in thread
From: H. Peter Anvin @ 2005-10-06 17:15 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List

Linus Torvalds wrote:
> The current "git tag -s" thing always uses the tagger name as the signing 
> user key, which is very irritating, since my key is under my email 
> address, but the tagger key obviously contains the actual machine name 
> too.
> 
> Now, I could just use "GIT_COMMITTER_EMAIL" and force it to be my real 
> email, but I actually think that it's nice to see which machine I use for 
> my work. 
> 
> So rather than force my tagger ID to have to match the gpg key name, just 
> support the "-u" flag to "git tag" instead. It implicitly enables signing, 
> since it doesn't make any sense without it. Thus:
> 
> 	git tag -u <gpg-key-name> <tag-name> [<tagged-object>]
> 
> will use the named gpg key for signing.

This is important for another reason as well: a lot of people have 
multiple keys.

	-hpa

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Allow "-u" flag to tag signing
  2005-10-06 17:15 ` H. Peter Anvin
@ 2005-10-06 20:17   ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2005-10-06 20:17 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Linus Torvalds, Git Mailing List

"H. Peter Anvin" <hpa@zytor.com> writes:

>> ... It implicitly enables signing, since it doesn't make any
>> sense without it. Thus:
>> 	git tag -u <gpg-key-name> <tag-name> [<tagged-object>]
>> will use the named gpg key for signing.
>
> This is important for another reason as well: a lot of people have 
> multiple keys.

Agreed.  Thanks both.  Will apply.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Allow "-u" flag to tag signing
  2005-10-06 16:58 Allow "-u" flag to tag signing Linus Torvalds
  2005-10-06 17:15 ` H. Peter Anvin
@ 2005-10-06 23:32 ` Chris Wright
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Wright @ 2005-10-06 23:32 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List

* Linus Torvalds (torvalds@osdl.org) wrote:
> So rather than force my tagger ID to have to match the gpg key name, just 
> support the "-u" flag to "git tag" instead. It implicitly enables signing, 
> since it doesn't make any sense without it. Thus:
> 
> 	git tag -u <gpg-key-name> <tag-name> [<tagged-object>]
> 
> will use the named gpg key for signing.

Nice, I've had a hack something like this locally here as well, and been
meaning to cleanup and submit.

thanks,
-chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-10-06 23:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-06 16:58 Allow "-u" flag to tag signing Linus Torvalds
2005-10-06 17:15 ` H. Peter Anvin
2005-10-06 20:17   ` Junio C Hamano
2005-10-06 23:32 ` Chris Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).