{"thread":{"id":"19764","subject":"[PATCH] Make git tag -s friendly to keys with comments","startedAt":"2009-06-09T23:48:51Z","lastAt":"2009-06-09T23:48:51Z","messageCount":1,"participants":["Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"115969","messageId":"20090609234851.GA5286@machine.or.cz","threadId":"19764","inReplyTo":null,"subject":"[PATCH] Make git tag -s friendly to keys with comments","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2009-06-09T23:48:51Z","receivedAt":"2009-06-09T23:48:51Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"git tag -s has very unfriendly default method of picking key ids;\nit is documented in git-tag(1) as just the e-mail, but in fact\nit is \"Real Name <email>\". This will never pick the right default\nif the key was created with a comment in the name, like:\n\n\tPetr Baudis (Sirius Labs) <pasky@ucw.cz>\n\tPetr Baudis (SuSE Labs) <pasky@suse.cz>\n\nThis patch makes git tag -s default to just the e-mail address,\nas documented.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n\ndiff --git a/builtin-tag.c b/builtin-tag.c\nindex e544430..9901925 100644\n--- a/builtin-tag.c\n+++ b/builtin-tag.c\n@@ -165,8 +165,10 @@ static int do_sign(struct strbuf *buffer)\n \tint i, j;\n \n \tif (!*signingkey) {\n-\t\tif (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME),\n-\t\t\t\tsizeof(signingkey)) > sizeof(signingkey) - 1)\n+\t\tchar *commit_email = strchr(git_committer_info(IDENT_ERROR_ON_NO_NAME), '<');\n+\t\tassert(commit_email);\n+\t\tif (strlcpy(signingkey, commit_email, sizeof(signingkey))\n+\t\t\t\t> sizeof(signingkey) - 1)\n \t\t\treturn error(\"committer info too long.\");\n \t\tbracket = strchr(signingkey, '>');\n \t\tif (bracket)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nThe lyf so short, the craft so long to lerne. -- Chaucer\n"}]}