{"thread":{"id":"14566","subject":"[PATCH] mailinfo: better parse email adresses containg parentheses","startedAt":"2008-07-21T13:34:29Z","lastAt":"2008-07-22T10:24:39Z","messageCount":4,"participants":["Philippe Bruhat (BooK)","Lukas Sandström","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"84196","messageId":"1216647269-12287-1-git-send-email-book@cpan.org","threadId":"14566","inReplyTo":null,"subject":"[PATCH] mailinfo: better parse email adresses containg parentheses","fromName":"Philippe Bruhat (BooK)","fromEmail":"book@cpan.org","sentAt":"2008-07-21T13:34:29Z","receivedAt":"2008-07-21T13:34:29Z","isPatch":true,"sender":{"key":"book@cpan.org","avatar":"https://avatars.githubusercontent.com/u/44421?v=4"},"body":"    When using git-rebase, author fields containing a ')' at the last\n    position had the close-parens character incorrectly removed\n    because the From: parser incorrectly matched it as\n\n        user@host (User Name)\n\n    (removing parentheses), instead of\n\n        User Name (me) <user@host>\n\nSigned-off-by: Philippe Bruhat (BooK) <book@cpan.org>\n---\n builtin-mailinfo.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\nindex b99a5b6..5581c9f 100644\n--- a/builtin-mailinfo.c\n+++ b/builtin-mailinfo.c\n@@ -115,10 +115,10 @@ static void handle_from(const struct strbuf *from)\n \t * the () pair at the end.\n \t */\n \tstrbuf_trim(&f);\n-\tif (f.buf[0] == '(')\n+\tif (f.buf[0] == '(' && f.len && f.buf[f.len - 1] == ')') {\n \t\tstrbuf_remove(&name, 0, 1);\n-\tif (f.len && f.buf[f.len - 1] == ')')\n \t\tstrbuf_setlen(&f, f.len - 1);\n+\t}\n \n \tget_sane_name(&name, &f, &email);\n \tstrbuf_release(&f);\n-- \n1.5.4.3\n"},{"id":"84197","messageId":"48849EEF.6070403@etek.chalmers.se","threadId":"14566","inReplyTo":"1216647269-12287-1-git-send-email-book@cpan.org","subject":"Re: [PATCH] mailinfo: better parse email adresses containg parentheses","fromName":"Lukas Sandström","fromEmail":"lukass@etek.chalmers.se","sentAt":"2008-07-21T14:36:31Z","receivedAt":"2008-07-21T14:36:31Z","isPatch":true,"sender":{"key":"luksan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/152281?v=4"},"body":"Philippe Bruhat (BooK) wrote:\n>     When using git-rebase, author fields containing a ')' at the last\n>     position had the close-parens character incorrectly removed\n>     because the From: parser incorrectly matched it as\n> \n>         user@host (User Name)\n> \n>     (removing parentheses), instead of\n> \n>         User Name (me) <user@host>\n> \n> Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>\n\nACK.\n\n> ---\n>  builtin-mailinfo.c |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n> index b99a5b6..5581c9f 100644\n> --- a/builtin-mailinfo.c\n> +++ b/builtin-mailinfo.c\n> @@ -115,10 +115,10 @@ static void handle_from(const struct strbuf *from)\n>  \t * the () pair at the end.\n>  \t */\n>  \tstrbuf_trim(&f);\n> -\tif (f.buf[0] == '(')\n> +\tif (f.buf[0] == '(' && f.len && f.buf[f.len - 1] == ')') {\n>  \t\tstrbuf_remove(&name, 0, 1);\nNote: The line above should obviously be \"strbuf_remove(&f, 0, 1);\",\nanother error from the strbuf conversion I made. Sigh.\n\n> -\tif (f.len && f.buf[f.len - 1] == ')')\n>  \t\tstrbuf_setlen(&f, f.len - 1);\n> +\t}\n>  \n>  \tget_sane_name(&name, &f, &email);\n>  \tstrbuf_release(&f);\n\n/Lukas\n"},{"id":"84266","messageId":"7v63qyr4kk.fsf@gitster.siamese.dyndns.org","threadId":"14566","inReplyTo":"1216647269-12287-1-git-send-email-book@cpan.org","subject":"Re: [PATCH] mailinfo: better parse email adresses containg parentheses","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-22T03:16:43Z","receivedAt":"2008-07-22T03:16:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philippe Bruhat (BooK)\" <book@cpan.org> writes:\n\n>     When using git-rebase, author fields containing a ')' at the last\n>     position had the close-parens character incorrectly removed\n>     because the From: parser incorrectly matched it as\n>\n>         user@host (User Name)\n>\n>     (removing parentheses), instead of\n>\n>         User Name (me) <user@host>\n>\n> Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>\n\nHmm, tests?\n\nBy the way, that second form parses like this:\n\n\tmailbox =\n        name-addr =\n        display-name angle-addr = \"User Name (me) <user@host>\"\n\n        display-name =\n        phrase = \"User Name\"\n        \n        angle-addr = CFWS \"<\" addr-spec \">\" = \"(me) <user@host>\"\n\nSo strictly speaking, shouldn't we be stripping the whole (me) as garbage?\nIt is not even part of the display-name but is a whitespace equivalent\ncomment.\n\n\n        \n"},{"id":"84318","messageId":"20080722102439.GB7792@plop","threadId":"14566","inReplyTo":"7v63qyr4kk.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] mailinfo: better parse email adresses containg parentheses","fromName":"Philippe Bruhat (BooK)","fromEmail":"book@cpan.org","sentAt":"2008-07-22T10:24:39Z","receivedAt":"2008-07-22T10:24:39Z","isPatch":true,"sender":{"key":"book@cpan.org","avatar":"https://avatars.githubusercontent.com/u/44421?v=4"},"body":"On Mon, Jul 21, 2008 at 08:16:43PM -0700, Junio C Hamano wrote:\n> >\n> > Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>\n> \n> Hmm, tests?\n> \n> By the way, that second form parses like this:\n> \n> \tmailbox =\n>         name-addr =\n>         display-name angle-addr = \"User Name (me) <user@host>\"\n> \n>         display-name =\n>         phrase = \"User Name\"\n>         \n>         angle-addr = CFWS \"<\" addr-spec \">\" = \"(me) <user@host>\"\n> \n> So strictly speaking, shouldn't we be stripping the whole (me) as garbage?\n> It is not even part of the display-name but is a whitespace equivalent\n> comment.\n\nWell, I use this:\n\n    \"Philippe Bruhat (BooK)\" <book@cpan.org>\n\nas my From: line, and I would like to be able to use it so in git.\n\nAs git knows the difference between user name and user email, it should\nbe able to keep the information separate all the way.\n\nWhich makes me think that since it seems that rebase goes through a\npatch-file step, the problem with my username may actually lie with\ncreating the patch file (no quotes around a user name containing parens)\nrather than with parsing the patch  From: line.\n\n-- \n Philippe Bruhat (BooK)\n\n Everyone's life seems easier from the outside.\n                                    (Moral from Groo The Wanderer #45 (Epic))\n"}]}