{"thread":{"id":"2032","subject":"Allow \"-u\" flag to tag signing","startedAt":"2005-10-06T16:58:02Z","lastAt":"2005-10-06T23:32:00Z","messageCount":4,"participants":["Linus Torvalds","H. Peter Anvin","Junio C Hamano","Chris Wright"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"9767","messageId":"Pine.LNX.4.64.0510060952410.31407@g5.osdl.org","threadId":"2032","inReplyTo":null,"subject":"Allow \"-u\" flag to tag signing","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-06T16:58:02Z","receivedAt":"2005-10-06T16:58:02Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nThe current \"git tag -s\" thing always uses the tagger name as the signing \nuser key, which is very irritating, since my key is under my email \naddress, but the tagger key obviously contains the actual machine name \ntoo.\n\nNow, I could just use \"GIT_COMMITTER_EMAIL\" and force it to be my real \nemail, but I actually think that it's nice to see which machine I use for \nmy work. \n\nSo rather than force my tagger ID to have to match the gpg key name, just \nsupport the \"-u\" flag to \"git tag\" instead. It implicitly enables signing, \nsince it doesn't make any sense without it. Thus:\n\n\tgit tag -u <gpg-key-name> <tag-name> [<tagged-object>]\n\nwill use the named gpg key for signing.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\nNot very well tested, but I re-did my v2.6.14-rc3 tag with this, since I'd \nmessed up the comments (and called it v2.6.14-rc2 in there ;)\n\nSo it may even work.\n\ndiff --git a/git-tag.sh b/git-tag.sh\n--- a/git-tag.sh\n+++ b/git-tag.sh\n@@ -12,6 +12,7 @@ annotate=\n signed=\n force=\n message=\n+username=\n while case \"$#\" in 0) break ;; esac\n do\n     case \"$1\" in\n@@ -30,6 +31,12 @@ do\n \tshift\n \tmessage=\"$1\"\n \t;;\n+    -u)\n+\tannotate=1\n+\tsigned=1\n+\tshift\n+\tusername=\"$1\"\n+\t;;\n     -*)\n         usage\n \t;;\n@@ -70,8 +77,11 @@ if [ \"$annotate\" ]; then\n     ( echo -e \"object $object\\ntype $type\\ntag $name\\ntagger $tagger\\n\"; cat .tagmsg ) > .tmp-tag\n     rm -f .tmp-tag.asc .tagmsg\n     if [ \"$signed\" ]; then\n-\tme=$(expr \"$tagger\" : '\\(.*>\\)') &&\n-\tgpg -bsa -u \"$me\" .tmp-tag &&\n+\t{\n+\t\t[ \"$username\" ] ||\n+\t\tusername=$(expr \"$tagger\" : '\\(.*>\\)')\n+\t} &&\n+\tgpg -bsa -u \"$username\" .tmp-tag &&\n \tcat .tmp-tag.asc >>.tmp-tag ||\n \tdie \"failed to sign the tag with GPG.\"\n     fi\n"},{"id":"9769","messageId":"43455BBC.6020908@zytor.com","threadId":"2032","inReplyTo":"Pine.LNX.4.64.0510060952410.31407@g5.osdl.org","subject":"Re: Allow \"-u\" flag to tag signing","fromName":"H. Peter Anvin","fromEmail":"hpa@zytor.com","sentAt":"2005-10-06T17:15:40Z","receivedAt":"2005-10-06T17:15:40Z","isPatch":false,"sender":{"key":"hpa@zytor.com","avatar":null},"body":"Linus Torvalds wrote:\n> The current \"git tag -s\" thing always uses the tagger name as the signing \n> user key, which is very irritating, since my key is under my email \n> address, but the tagger key obviously contains the actual machine name \n> too.\n> \n> Now, I could just use \"GIT_COMMITTER_EMAIL\" and force it to be my real \n> email, but I actually think that it's nice to see which machine I use for \n> my work. \n> \n> So rather than force my tagger ID to have to match the gpg key name, just \n> support the \"-u\" flag to \"git tag\" instead. It implicitly enables signing, \n> since it doesn't make any sense without it. Thus:\n> \n> \tgit tag -u <gpg-key-name> <tag-name> [<tagged-object>]\n> \n> will use the named gpg key for signing.\n\nThis is important for another reason as well: a lot of people have \nmultiple keys.\n\n\t-hpa\n"},{"id":"9776","messageId":"7vwtkq8kne.fsf@assigned-by-dhcp.cox.net","threadId":"2032","inReplyTo":"43455BBC.6020908@zytor.com","subject":"Re: Allow \"-u\" flag to tag signing","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-06T20:17:57Z","receivedAt":"2005-10-06T20:17:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"H. Peter Anvin\" <hpa@zytor.com> writes:\n\n>> ... It implicitly enables signing, since it doesn't make any\n>> sense without it. Thus:\n>> \tgit tag -u <gpg-key-name> <tag-name> [<tagged-object>]\n>> will use the named gpg key for signing.\n>\n> This is important for another reason as well: a lot of people have \n> multiple keys.\n\nAgreed.  Thanks both.  Will apply.\n"},{"id":"9783","messageId":"20051006233200.GR8041@shell0.pdx.osdl.net","threadId":"2032","inReplyTo":"Pine.LNX.4.64.0510060952410.31407@g5.osdl.org","subject":"Re: Allow \"-u\" flag to tag signing","fromName":"Chris Wright","fromEmail":"chrisw@osdl.org","sentAt":"2005-10-06T23:32:00Z","receivedAt":"2005-10-06T23:32:00Z","isPatch":false,"sender":{"key":"chrisw@sous-sol.org","avatar":null},"body":"* Linus Torvalds (torvalds@osdl.org) wrote:\n> So rather than force my tagger ID to have to match the gpg key name, just \n> support the \"-u\" flag to \"git tag\" instead. It implicitly enables signing, \n> since it doesn't make any sense without it. Thus:\n> \n> \tgit tag -u <gpg-key-name> <tag-name> [<tagged-object>]\n> \n> will use the named gpg key for signing.\n\nNice, I've had a hack something like this locally here as well, and been\nmeaning to cleanup and submit.\n\nthanks,\n-chris\n"}]}