gitweb.cgi: git_blame2: slight optimization reading the blame lines
Eliminate git_read_blame_line() -- move that code inline and optimize it. Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:

committed by
Junio C Hamano

parent
cc1bf97e24
commit
acb0f6f337
@ -1252,15 +1252,6 @@ sub git_tag {
|
|||||||
git_footer_html();
|
git_footer_html();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub git_read_blame_line {
|
|
||||||
my %bl;
|
|
||||||
$_ = shift;
|
|
||||||
|
|
||||||
($bl{'hash'}, $bl{'lineno'}, $bl{'data'}) = /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
|
|
||||||
|
|
||||||
return %bl;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub git_blame2 {
|
sub git_blame2 {
|
||||||
my $fd;
|
my $fd;
|
||||||
my $ftype;
|
my $ftype;
|
||||||
@ -1302,12 +1293,12 @@ sub git_blame2 {
|
|||||||
print "<div class=\"page_body\">\n";
|
print "<div class=\"page_body\">\n";
|
||||||
print "<table class=\"blame\">\n";
|
print "<table class=\"blame\">\n";
|
||||||
print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n";
|
print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n";
|
||||||
while (my $line = <$fd>) {
|
while (<$fd>) {
|
||||||
my %blame_line = git_read_blame_line($line);
|
/^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
|
||||||
my $full_rev = $blame_line{'hash'};
|
my $full_rev = $1;
|
||||||
my $rev = substr($full_rev, 0, 8);
|
my $rev = substr($full_rev, 0, 8);
|
||||||
my $lineno = $blame_line{'lineno'};
|
my $lineno = $2;
|
||||||
my $data = $blame_line{'data'};
|
my $data = $3;
|
||||||
|
|
||||||
if (!defined $last_rev) {
|
if (!defined $last_rev) {
|
||||||
$last_rev = $full_rev;
|
$last_rev = $full_rev;
|
||||||
|
Reference in New Issue
Block a user