]> rtime.felk.cvut.cz Git - git.git/commitdiff
gitweb: Add author initials in 'blame' view, a la "git gui blame"
authorJakub Narebski <jnareb@gmail.com>
Fri, 24 Jul 2009 22:44:05 +0000 (00:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 25 Jul 2009 08:39:16 +0000 (01:39 -0700)
For example for "Junio C Hamano" initials would be "JH".  Of course
initials are added (below shortened SHA-1 of blamed commit) only if
group of lines that blame the same commit has 2 or more lines in it.

Initials are extracted using i18n /\b([[:upper:]])\B/g regexp.

Additionally initials help to distinguish boundary commits, as they
use bold weight font too (in addition to shortened SHA-1 of commit).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl

index 128bddd38154fa6fb745f42a5553e5bde9360a2b..ea1ab5f846ec34f41af803d23357fdacac3f9bb5 100755 (executable)
@@ -4855,6 +4855,14 @@ HTML
                                                     hash=>$full_rev,
                                                     file_name=>$file_name)},
                                      esc_html($short_rev));
+                       if ($group_size >= 2) {
+                               my @author_initials = ($author =~ /\b([[:upper:]])\B/g);
+                               if (@author_initials) {
+                                       print "<br />" .
+                                             esc_html(join('', @author_initials));
+                                       #           or join('.', ...)
+                               }
+                       }
                        print "</td>\n";
                }
                # 'previous' <sha1 of parent commit> <filename at commit>