From: Jakub Narebski Date: Fri, 24 Jul 2009 22:44:05 +0000 (+0200) Subject: gitweb: Add author initials in 'blame' view, a la "git gui blame" X-Git-Tag: v1.6.5-rc0~72^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a36817b6e7af625a6f1218a2d57874f5016e2c8d;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 128bddd38..ea1ab5f84 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -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 "
" . + esc_html(join('', @author_initials)); + # or join('.', ...) + } + } print "\n"; } # 'previous'