]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Add author initials in 'blame' view, a la "git gui blame"
authorJakub Narebski <redacted>
Fri, 24 Jul 2009 22:44:05 +0000 (00:44 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:39 +0000 (00:50 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index bf75e53f21c870017817838706a7e63079c3cd44298400f4e6cfe6053a966bd8..e4cac4512397de7466452af99ba4e822d133b574c561509abc3502b5a5a2190c 100755 (executable)
@@ -4856,6 +4856,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>
This page took 0.370426 seconds and 4 git commands to generate.