All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gitk - fix a problem with multiline author names
@ 2012-11-13 20:26 Tomo Krajina
  0 siblings, 0 replies; only message in thread
From: Tomo Krajina @ 2012-11-13 20:26 UTC (permalink / raw)
  To: git

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
 <user.name@domain.com>
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 <tkrajina@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
comdate
+            set comname [string trim $comname]
+            set comname "$comname <$email>"
+        }
     }
     set headline {}
     # take the first non-blank line of the comment as the headline
--
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-11-13 20:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-13 20:26 [PATCH] gitk - fix a problem with multiline author names Tomo Krajina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.