\n";
+ }
+ $alternate ^= 1;
+ print "| " . mode_str($t_mode) . " | \n";
if ($t_type eq "blob") {
print "" .
$cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key, -class => "list"}, $t_name) .
@@ -1005,6 +1044,9 @@ sub git_tree {
print " | " .
$cgi->a({-href => "$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key}, $t_name) .
" | \n";
+ print "" .
+ $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base" . $file_key}, "history") .
+ " | \n";
}
print "
\n";
}
@@ -1156,22 +1198,34 @@ sub git_commit {
print "\n" .
- "
\n";
+ print "\n";
+ my $alternate = 0;
foreach my $line (@difftree) {
# '*100644->100644 blob 9f91a116d91926df3ba936a80f020a6ab1084d2b->bb90a0c3a91eb52020d0db0e8b4f94d30e02d596 net/ipv4/route.c'
# '+100644 blob 4a83ab6cd565d21ab0385bac6643826b83c2fcd4 arch/arm/lib/bitops.h'
# '*100664->100644 blob b1a8e3dd5556b61dd771d32307c6ee5d7150fa43->b1a8e3dd5556b61dd771d32307c6ee5d7150fa43 show-files.c'
# '*100664->100644 blob d08e895238bac36d8220586fdc28c27e1a7a76d3->d08e895238bac36d8220586fdc28c27e1a7a76d3 update-cache.c'
- $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
+ $line =~ m/^(.)(.+)\t(.+)\t([0-9a-fA-F]{40}|[0-9a-fA-F]{40}->[0-9a-fA-F]{40})\t(.+)$/;
my $op = $1;
my $mode = $2;
my $type = $3;
@@ -1219,7 +1273,12 @@ sub git_commit {
if ($type ne "blob") {
next;
}
- print "\n";
+ if ($alternate) {
+ print "
\n";
+ } else {
+ print "
\n";
+ }
+ $alternate ^= 1;
if ($op eq "+") {
my $mode_chng = "";
if (S_ISREG(oct $mode)) {
@@ -1277,8 +1336,7 @@ sub git_commit {
}
print "
\n";
}
- print "
\n" .
- "\n";
+ print "
\n";
git_footer_html();
}
@@ -1326,7 +1384,10 @@ sub git_commitdiff {
if (!%co) {
die_error(undef, "Unknown commit object.");
}
- open my $fd, "-|", "$gitbin/git-diff-tree -r $co{'parent'} $hash" || die_error(undef, "Open failed.");
+ if (!defined $hash_parent) {
+ $hash_parent = $co{'parent'};
+ }
+ open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" || die_error(undef, "Open failed.");
my (@difftree) = map { chomp; $_ } <$fd>;
close $fd || die_error(undef, "Reading diff-tree failed.");
@@ -1367,7 +1428,7 @@ sub git_commitdiff {
print "
\n";
foreach my $line (@difftree) {
# '*100644->100644 blob 8e5f9bbdf4de94a1bc4b4da8cb06677ce0a57716->8da3a306d0c0c070d87048d14a033df02f40a154 Makefile'
- $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
+ $line =~ m/^(.)(.+)\t(.+)\t([0-9a-fA-F]{40}|[0-9a-fA-F]{40}->[0-9a-fA-F]{40})\t(.+)$/;
my $op = $1;
my $mode = $2;
my $type = $3;
@@ -1431,43 +1492,42 @@ sub git_history {
open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin $file_name";
my $commit;
- print "
\n" .
- "
\n";
+ print "\n";
+ my $alternate = 0;
while (my $line = <$fd>) {
if ($line =~ m/^([0-9a-fA-F]{40}) /){
$commit = $1;
next;
}
- if ($line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/ && (defined $commit)) {
- my $type = $3;
- my $file = $5;
- if ($file ne $file_name || $type ne "blob") {
- next;
- }
+ if ($line =~ m/^(.)(.+)\t(.+)\t([0-9a-fA-F]{40}->[0-9a-fA-F]{40})\t(.+)$/ && (defined $commit)) {
my %co = git_read_commit($commit);
if (!%co) {
next;
}
- print "" .
- "| $co{'age_string'} | \n" .
- "$co{'author_name'} | \n" .
+ if ($alternate) {
+ print "
\n";
+ } else {
+ print "
\n";
+ }
+ $alternate ^= 1;
+ print "| $co{'age_string'} | \n" .
+ "" . escapeHTML(chop_str($co{'author_name'}, 10)) . " | \n" .
"" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"}, "" . escapeHTML($co{'title'}) . "") . " | \n" .
"" .
$cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") .
" | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$commit"}, "tree") .
- " | " . $cgi->a({-href => "$my_uri?p=$project;a=blob;hb=$commit;f=$file"}, "blob");
+ " | " . $cgi->a({-href => "$my_uri?p=$project;a=blob;hb=$commit;f=$file_name"}, "blob");
my $blob = git_get_hash_by_path($hash, $file_name);
my $blob_parent = git_get_hash_by_path($commit, $file_name);
if (defined $blob && defined $blob_parent && $blob ne $blob_parent) {
- print " | " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=$file"}, "diff");
+ print " | " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=$file_name"}, "diff");
}
print " | \n" .
"
\n";
undef $commit;
}
}
- print "
\n" .
- "\n";
+ print "
\n";
close $fd;
git_footer_html();
}