Skip to content

Commit a36817b

Browse files
jnarebgitster
authored andcommitted
gitweb: Add author initials in 'blame' view, a la "git gui blame"
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>
1 parent 3665e7e commit a36817b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gitweb/gitweb.perl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4855,6 +4855,14 @@ sub git_blame {
48554855
hash=>$full_rev,
48564856
file_name=>$file_name)},
48574857
esc_html($short_rev));
4858+
if ($group_size >= 2) {
4859+
my @author_initials = ($author =~ /\b([[:upper:]])\B/g);
4860+
if (@author_initials) {
4861+
print "<br />" .
4862+
esc_html(join('', @author_initials));
4863+
# or join('.', ...)
4864+
}
4865+
}
48584866
print "</td>\n";
48594867
}
48604868
# 'previous' <sha1 of parent commit> <filename at commit>

0 commit comments

Comments
 (0)