Code

git-gui: Skip nicknames when selecting author initials
authorShawn O. Pearce <spearce@spearce.org>
Mon, 9 Jul 2007 01:06:43 +0000 (21:06 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 9 Jul 2007 01:06:43 +0000 (21:06 -0400)
Our blame viewer only grabbed the first initial of the git.git
author string "Simon 'corecode' Schubert".  Here the problem was we
looked at Simon, pulled the S into the author initials, then saw
the single quote as the start of the next name and did not like
this character as it was not an uppercase letter.

We now skip over single quoted nicknames placed within the author
name field and grab the initials following it.  So the above name
will get the initials SS, rather than just S.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
lib/blame.tcl

index b5236548152043c5ec29997a791f5a51fa3f56cb..1d2caac2835c27280e1d4b9ec58c51b746e2dd01 100644 (file)
@@ -547,6 +547,10 @@ method _read_blame {fd cur_w cur_d cur_s} {
                        set a_name {}
                        catch {set a_name $header($cmit,author)}
                        while {$a_name ne {}} {
+                               if {$author_abbr ne {}
+                                       && [string index $a_name 0] eq {'}} {
+                                       regsub {^'[^']+'\s+} $a_name {} a_name
+                               }
                                if {![regexp {^([[:upper:]])} $a_name _a]} break
                                append author_abbr $_a
                                unset _a