{"thread":{"id":"32103","subject":"[PATCH] gitk - fix a problem with multiline author names","startedAt":"2012-11-13T20:26:05Z","lastAt":"2012-11-13T20:26:05Z","messageCount":1,"participants":["Tomo Krajina"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"203141","messageId":"CAEEdOy+6mBuvyemD8r5H1qVqag4s03AqG1aYN2J+w5PNjEKhhA@mail.gmail.com","threadId":"32103","inReplyTo":null,"subject":"[PATCH] gitk - fix a problem with multiline author names","fromName":"Tomo Krajina","fromEmail":"tkrajina@gmail.com","sentAt":"2012-11-13T20:26:05Z","receivedAt":"2012-11-13T20:26:05Z","isPatch":true,"sender":{"key":"tkrajina@gmail.com","avatar":null},"body":"When commiting with \"git-commit\" no newline in the author string\nis possible. But other git clients don't have the same validations\nfor the author name. And, it is possible to have a commit like:\n\ncommit xxxxxxxx\nMerge: aaaaa bbbbb\nAuthor: User Name\n <user.name@domain.com>\nDate:   Thu Nov 8 17:01:02 2012 +0100\n\n    Merge branch 'master' of ...\n\nNote that the \"Author:\" string is split in two lines.\n\nThe git-log command work without problems with a commit like this, but\nin gitk there is a problem because it splits the headers by a newline\ncharacter and that's why the email and time is not correctly parsed\nand the history tree below this commit is not shown.\n\nSigned-off-by: Tomo Krajina <tkrajina@gmail.com>\n---\n gitk-git/gitk |   16 +++++++++-------\n 1 file changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 6f24f53..87300db 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -1672,13 +1672,15 @@ proc parsecommit {id contents listed} {\n     foreach line [split $header \"\\n\"] {\n  set line [split $line \" \"]\n  set tag [lindex $line 0]\n- if {$tag == \"author\"} {\n-    set audate [lrange $line end-1 end]\n-    set auname [join [lrange $line 1 end-2] \" \"]\n- } elseif {$tag == \"committer\"} {\n-    set comdate [lrange $line end-1 end]\n-    set comname [join [lrange $line 1 end-2] \" \"]\n- }\n+        if {$tag == \"author\"} {\n+            regexp -lineanchor {\\nauthor([^<]*)<([^>]*)>\\s+([^\\n]+)}\n$header all auname email audate\n+            set auname [string trim $auname]\n+            set auname \"$auname <$email>\"\n+        } elseif {$tag == \"committer\"} {\n+            regexp -lineanchor\n{\\ncommitter([^<]*)<([^>]*)>\\s+([^\\n]+)} $header all comname email\ncomdate\n+            set comname [string trim $comname]\n+            set comname \"$comname <$email>\"\n+        }\n     }\n     set headline {}\n     # take the first non-blank line of the comment as the headline\n--\n1.7.9.5\n"}]}