Skip to content

Commit

Permalink
gitweb: Add author initials in 'blame' view, a la "git gui blame"
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Jul 25, 2009
1 parent 3665e7e commit a36817b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -4855,6 +4855,14 @@ sub git_blame {
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>
Expand Down

0 comments on commit a36817b

Please sign in to comment.