When commiting with "git-commit" no newline in the author string
is possible. But other git clients don't have the same validations
for the author name. And, it is possible to have a commit like:

commit xxxxxxxx
Merge: aaaaa bbbbb
Author: User Name
Date:   Thu Nov 8 17:01:02 2012 +0100

    Merge branch 'master' of ...

Note that the "Author:" string is split in two lines.

The git-log command work without problems with a commit like this, but
in gitk there is a problem because it splits the headers by a newline
character and that's why the email and time is not correctly parsed
and the history tree below this commit is not shown.

Signed-off-by: Tomo Krajina <tkraj...@gmail.com>
 gitk-git/gitk |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 6f24f53..87300db 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1672,13 +1672,15 @@ proc parsecommit {id contents listed} {
     foreach line [split $header "\n"] {
  set line [split $line " "]
  set tag [lindex $line 0]
- if {$tag == "author"} {
-    set audate [lrange $line end-1 end]
-    set auname [join [lrange $line 1 end-2] " "]
- } elseif {$tag == "committer"} {
-    set comdate [lrange $line end-1 end]
-    set comname [join [lrange $line 1 end-2] " "]
- }
+        if {$tag == "author"} {
+            regexp -lineanchor {\nauthor([^<]*)<([^>]*)>\s+([^\n]+)}
$header all auname email audate
+            set auname [string trim $auname]
+            set auname "$auname <$email>"
+        } elseif {$tag == "committer"} {
+            regexp -lineanchor
{\ncommitter([^<]*)<([^>]*)>\s+([^\n]+)} $header all comname email
+            set comname [string trim $comname]
+            set comname "$comname <$email>"
+        }
     set headline {}
     # take the first non-blank line of the comment as the headline
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to