";
}
my $branchlist = git_read_refs("refs/heads");
@@ -784,15 +804,21 @@ sub git_summary {
print "
\n" .
$cgi->a({-href => "$my_uri?p=$project;a=branches", -class => "title"}, "branches") .
"
\n" .
- "
\n";
+ my $i = 15;
+ print "\n";
+ my $alternate = 0;
foreach my $entry (@$branchlist) {
my %tag = %$entry;
- print "\n";
+ if ($alternate) {
+ print "
\n";
+ } else {
+ print "
\n";
+ }
+ $alternate ^= 1;
if (--$i > 0) {
- print "| $tag{'age'} | \n" .
- "" . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, escapeHTML($tag{'name'})) . " | \n" .
+ print "$tag{'age'} | \n" .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}", -class => "list"}, "" . escapeHTML($tag{'name'}) . "") . " | \n" .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log") . " | \n" .
"
";
} else {
print "" . $cgi->a({-href => "$my_uri?p=$project;a=branches"}, "...") . " | \n" .
@@ -800,8 +826,7 @@ sub git_summary {
last;
}
}
- print "
" .
- "\n";
+ print "
";
}
git_footer_html();
}
@@ -819,16 +844,24 @@ sub git_tags {
print "
\n" .
$cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, "tags") .
"
\n";
+ print "
\n";
+ my $alternate = 0;
if (defined @$taglist) {
foreach my $entry (@$taglist) {
my %tag = %$entry;
- print "\n" .
- $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"},
- "$tag{'age'}" . escapeHTML($tag{'name'})) . "\n" .
- "
\n";
+ if ($alternate) {
+ print "\n";
+ } else {
+ print "
\n";
+ }
+ $alternate ^= 1;
+ print "| $tag{'age'} | \n" .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}", -class => "list"}, "" . escapeHTML($tag{'name'}) . "") . " | \n" .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"}, $tag{'type'}) . " | \n" .
+ "
";
}
}
- print "
\n";
+ print "
";
git_footer_html();
}
@@ -845,16 +878,24 @@ sub git_branches {
print "
\n" .
$cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, "branches") .
"
\n";
+ print "
\n";
+ my $alternate = 0;
if (defined @$taglist) {
foreach my $entry (@$taglist) {
my %tag = %$entry;
- print "\n" .
- $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"},
- "$tag{'age'}" . escapeHTML($tag{'name'})) . "\n" .
- "
\n";
+ if ($alternate) {
+ print "\n";
+ } else {
+ print "
\n";
+ }
+ $alternate ^= 1;
+ print "| $tag{'age'} | \n" .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}", -class => "list"}, "" . escapeHTML($tag{'name'}) . "") . " | \n" .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log") . " | \n" .
+ "
";
}
}
- print "
\n";
+ print "
";
git_footer_html();
}
@@ -870,7 +911,7 @@ sub git_get_hash_by_path {
close $fd || return undef;
foreach my $line (@entries) {
#'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
- $line =~ m/^([0-9]+)\t(.*)\t(.*)\t(.*)$/;
+ $line =~ m/^([0-9]+)\t(.+)\t([0-9a-fA-F]{40})\t(.+)$/;
my $t_mode = $1;
my $t_type = $2;
my $t_hash = $3;
@@ -938,9 +979,9 @@ sub git_tree {
my $base = $hash_base || git_read_hash("$project/HEAD");
$hash = git_get_hash_by_path($base, $file_name, "tree");
}
- }
- if (!defined $hash_base) {
- $hash_base = git_read_hash("$project/HEAD");
+ if (!defined $hash_base) {
+ $hash_base = git_read_hash("$project/HEAD");
+ }
}
open my $fd, "-|", "$gitbin/git-ls-tree $hash" || die_error(undef, "Open git-ls-tree failed.");
my (@entries) = map { chomp; $_ } <$fd>;
@@ -975,26 +1016,37 @@ sub git_tree {
}
print "
\n";
print "
\n";
+ my $alternate = 0;
foreach my $line (@entries) {
#'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
- $line =~ m/^([0-9]+)\t(.*)\t(.*)\t(.*)$/;
+ $line =~ m/^([0-9]+)\t(.+)\t([0-9a-fA-F]{40})\t(.+)$/;
my $t_mode = $1;
my $t_type = $2;
my $t_hash = $3;
my $t_name = $4;
$file_key = ";f=$base$t_name";
- print "\n" .
- "| " . mode_str($t_mode) . " | \n";
+ if ($alternate) {
+ print "
\n";
+ } else {
+ print "
\n";
+ }
+ $alternate ^= 1;
+ print "| " . mode_str($t_mode) . " | \n";
if ($t_type eq "blob") {
- print "$t_name | \n";
+ print "" .
+ $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key, -class => "list"}, $t_name) .
+ " | \n";
print "" .
$cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key}, "blob") .
" | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base" . $file_key}, "history") .
" | \n";
} elsif ($t_type eq "tree") {
- print "" .
+ 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";
}
@@ -1085,7 +1137,7 @@ sub git_log {
my $comment = $co{'comment'};
my $empty = 0;
foreach my $line (@$comment) {
- if ($line =~ m/^(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
+ if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
next;
}
if ($line eq "") {
@@ -1146,22 +1198,34 @@ sub git_commit {
print "\n" .
"
\n";
print "| author | " . escapeHTML($co{'author'}) . " |
\n".
- " | $ad{'rfc2822'}";
+ " |
" .
+ " | $ad{'rfc2822'}";
if ($ad{'hour_local'} < 6) {
printf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
} else {
printf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
}
- print " |
\n";
+ print "" .
+ "\n";
print "| committer | " . escapeHTML($co{'committer'}) . " |
\n";
print " | $cd{'rfc2822'}" . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . " |
\n";
- print "| commit | $hash |
\n";
- print "| tree | " .
- $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, $co{'tree'}) . " |
\n";
+ print "| commit | $hash |
\n";
+ print "" .
+ "| tree | " .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash", class => "list"}, $co{'tree'}) . " | " .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") .
+ " | " .
+ "
\n";
my $parents = $co{'parents'};
foreach my $par (@$parents) {
- print "| parent | " .
- $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$par"}, $par) . " |
\n";
+ print "" .
+ "| parent | " .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$par", class => "list"}, $par) . " | " .
+ "" .
+ $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$par"}, "commit") .
+ " |" . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash;hp=$par"}, "commitdiff") .
+ " | " .
+ "
\n";
}
print "
".
"
\n";
@@ -1179,7 +1243,7 @@ sub git_commit {
} else {
$empty = 0;
}
- if ($line =~ m/^(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
+ if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
$signed = 1;
print "" . escapeHTML($line) . "
\n";
} else {
@@ -1193,81 +1257,86 @@ sub git_commit {
print(($#difftree + 1) . " files changed:\n");
}
print "\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;
my $id = $4;
my $file = $5;
- if ($type eq "blob") {
- if ($op eq "+") {
- my $mode_chng = "";
- if (S_ISREG(oct $mode)) {
- $mode_chng = sprintf(" with mode: %04o", (oct $mode) & 0777);
+ if ($type ne "blob") {
+ next;
+ }
+ if ($alternate) {
+ print "\n";
+ } else {
+ print "
\n";
+ }
+ $alternate ^= 1;
+ if ($op eq "+") {
+ my $mode_chng = "";
+ if (S_ISREG(oct $mode)) {
+ $mode_chng = sprintf(" with mode: %04o", (oct $mode) & 0777);
+ }
+ print "| " .
+ $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hp=$hash;f=$file", -class => "list"}, escapeHTML($file)) . " | \n" .
+ "[new " . file_type($mode) . "$mode_chng] | \n" .
+ "" . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, "blob") . " | \n";
+ } elsif ($op eq "-") {
+ print "" .
+ $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file", -class => "list"}, escapeHTML($file)) . " | \n" .
+ "[deleted " . file_type($mode). "] | \n" .
+ "" .
+ $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, "blob") .
+ " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") .
+ " | \n"
+ } elsif ($op eq "*") {
+ $id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
+ my $from_id = $1;
+ my $to_id = $2;
+ $mode =~ m/^([0-7]{6})->([0-7]{6})$/;
+ my $from_mode = $1;
+ my $to_mode = $2;
+ my $mode_chnge = "";
+ if ($from_mode != $to_mode) {
+ $mode_chnge = " [changed";
+ if (((oct $from_mode) & S_IFMT) != ((oct $to_mode) & S_IFMT)) {
+ $mode_chnge .= " from " . file_type($from_mode) . " to " . file_type($to_mode);
}
- print "\n" .
- $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"},
- escapeHTML($file) . " [new " . file_type($mode) . "$mode_chng]") . "\n" .
- "
\n";
- print "\n" .
- $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, "blob") . "\n" .
- "
\n";
- } elsif ($op eq "-") {
- print "\n" .
- $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"},
- escapeHTML($file) . " [deleted " . file_type($mode) . "]") . "\n" .
- "
";
- print "\n" .
- $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, "blob") . " | " .
- $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") . "\n" .
- "
\n";
- } elsif ($op eq "*") {
- $id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
- my $from_id = $1;
- my $to_id = $2;
- $mode =~ m/^([0-7]{6})->([0-7]{6})$/;
- my $from_mode = $1;
- my $to_mode = $2;
- my $mode_chnge = "";
- if ($from_mode != $to_mode) {
- $mode_chnge = " [changed";
- if (((oct $from_mode) & S_IFMT) != ((oct $to_mode) & S_IFMT)) {
- $mode_chnge .= " from " . file_type($from_mode) . " to " . file_type($to_mode);
- }
- if (((oct $from_mode) & 0777) != ((oct $to_mode) & 0777)) {
- if (S_ISREG($from_mode) && S_ISREG($to_mode)) {
- $mode_chnge .= sprintf(" mode: %04o->%04o", (oct $from_mode) & 0777, (oct $to_mode) & 0777);
- } elsif (S_ISREG($to_mode)) {
- $mode_chnge .= sprintf(" mode: %04o", (oct $to_mode) & 0777);
- }
+ if (((oct $from_mode) & 0777) != ((oct $to_mode) & 0777)) {
+ if (S_ISREG($from_mode) && S_ISREG($to_mode)) {
+ $mode_chnge .= sprintf(" mode: %04o->%04o", (oct $from_mode) & 0777, (oct $to_mode) & 0777);
+ } elsif (S_ISREG($to_mode)) {
+ $mode_chnge .= sprintf(" mode: %04o", (oct $to_mode) & 0777);
}
- $mode_chnge .= "]\n";
}
- print "\n";
- if ($to_id ne $from_id) {
- print $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"},
- escapeHTML($file) . $mode_chnge) . "\n" .
- "
\n";
- } else {
- print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"},
- escapeHTML($file) . $mode_chnge) . "\n" .
- "\n";
- }
- print "\n";
- if ($to_id ne $from_id) {
- print $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"}, "diff") . " | ";
- }
- print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"}, "blob") . " | " .
- $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") . "\n" .
- "
\n";
+ $mode_chnge .= "]\n";
+ }
+ print "";
+ if ($to_id ne $from_id) {
+ print $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file", -class => "list"}, escapeHTML($file));
+ } else {
+ print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file", -class => "list"}, escapeHTML($file));
}
+ print " | \n" .
+ "$mode_chnge | \n" .
+ "";
+ print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"}, "blob");
+ if ($to_id ne $from_id) {
+ print " | " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"}, "diff");
+ }
+ print " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") . "\n";
+ print " | \n";
}
+ print "
\n";
}
+ print "
\n";
git_footer_html();
}
@@ -1315,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.");
@@ -1334,12 +1406,13 @@ sub git_commitdiff {
my $empty = 0;
my $signed = 0;
my @log = @$comment;
+ # remove first and empty lines after that
shift @log;
- #while ($log[0] eq "") {
- # shift @log;
- #}
+ while (defined $log[0] && $log[0] eq "") {
+ shift @log;
+ }
foreach my $line (@log) {
- if ($line =~ m/^(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
+ if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
next;
}
if ($line eq "") {
@@ -1355,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;
@@ -1416,41 +1489,45 @@ sub git_history {
print "\n" .
"/$file_name
\n";
print "
\n";
+
open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin $file_name";
my $commit;
+ 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 "\n" .
- $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"},
- "$co{'age_string'}" . escapeHTML($co{'title'})) . "\n" .
- "
\n";
- print "\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";
+ print " | \n" .
+ "
\n";
undef $commit;
}
}
+ print "
\n";
close $fd;
git_footer_html();
}