\n";
- open(my $fd, "-|", "$gitbin/cat-file blob $hash");
+ open(my $fd, "-|", "$gitbin/git-cat-file blob $hash");
my $nr;
while (my $line = <$fd>) {
$nr++;
@@ -407,13 +416,13 @@ if ($action eq "blob") {
if ($hash eq "") {
$hash = git_head($project);
}
- open my $fd, "-|", "$gitbin/ls-tree $hash";
+ open my $fd, "-|", "$gitbin/git-ls-tree $hash";
my (@entries) = map { chomp; $_ } <$fd>;
close $fd;
git_header_html();
my %co = git_commit($hash);
- if (defined(%co)) {
+ if (%co) {
print " view\n" .
$cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | " .
$cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "diffs") . " | " .
@@ -446,85 +455,88 @@ if ($action eq "blob") {
print "\n";
print "
";
git_footer_html();
-} elsif ($action eq "log" || $action eq "rss") {
- open my $fd, "-|", "$gitbin/rev-list " . git_head($project);
+} elsif ($action eq "rss") {
+ open my $fd, "-|", "$gitbin/git-rev-list --max-count=20 " . git_head($project);
my (@revlist) = map { chomp; $_ } <$fd>;
close $fd;
- if ($action eq "log") {
- git_header_html();
- print "\n";
- print "view ";
- print $cgi->a({-href => "$my_uri?p=$project;a=log"}, "last day") . " | " .
- $cgi->a({-href => "$my_uri?p=$project;a=log;t=7"}, "week") . " | " .
- $cgi->a({-href => "$my_uri?p=$project;a=log;t=31"}, "month") . " | " .
- $cgi->a({-href => "$my_uri?p=$project;a=log;t=365"}, "year") . " | " .
- $cgi->a({-href => "$my_uri?p=$project;a=log;t=0"}, "all") . "
\n";
- print "
\n" .
- "
\n";
- } elsif ($action eq "rss") {
- print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
- print "\n".
- "\n";
- print "\n";
- print "$project\n".
- " " . $my_url . "/$project/log\n".
- "$project log\n".
- "en\n";
- }
-
- for (my $i = 0; $i <= $#revlist; $i++) {
- my $commit = $revlist[$i];
+ print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
+ print "\n".
+ "\n";
+ print "\n";
+ print "$project\n".
+ " " . $my_url . "/$project/log\n".
+ "$project log\n".
+ "en\n";
+
+ foreach my $commit (@revlist) {
my %co = git_commit($commit);
my %ad = date_str($co{'author_epoch'});
- if ($action eq "log") {
- if ($time_back > 0 && $co{'age'} > $time_back*60*60*24) {
- if ($i == 0) {
- print " Last change " . $co{'age_string'} . ".
\n";
- }
- last;
- }
- print "\n" .
- $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "title"},
- "" . $co{'age_string'} . "" . escapeHTML($co{'title'})) . "\n" .
- "
\n";
- print "\n" .
- "
\n" .
- "view " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " .
- $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "diff") . "
\n" .
- "
\n" .
- "
" . escapeHTML($co{'author_name'}) . " [" . $ad{'rfc2822'} . "]\n" .
- "
\n" .
- "\n";
- my $comment = $co{'comment'};
- foreach my $line (@$comment) {
- last if ($line =~ m/^(signed-off|acked)-by:/i);
- print escapeHTML($line) . "
\n";
- }
- print "
\n" .
- "
\n";
- } elsif ($action eq "rss") {
- last if ($i >= 20);
- print "- \n" .
- "\t" . sprintf("%d %s %02d:%02d", $ad{'mday'}, $ad{'month'}, $ad{'hour'}, $ad{'min'}) . " - " . escapeHTML($co{'title'}) . "\n" .
- "\t " . $my_url . "?p=$project;a=commit;h=$commit\n" .
- "\t";
- my $comment = $co{'comment'};
- foreach my $line (@$comment) {
- print escapeHTML($line) . "\n";
- }
- print "\t\n" .
- "
\n";
+ print "- \n" .
+ "\t" . sprintf("%d %s %02d:%02d", $ad{'mday'}, $ad{'month'}, $ad{'hour'}, $ad{'min'}) . " - " . escapeHTML($co{'title'}) . "\n" .
+ "\t " . $my_url . "?p=$project;a=commit;h=$commit\n" .
+ "\t";
+ my $comment = $co{'comment'};
+ foreach my $line (@$comment) {
+ print escapeHTML($line) . "
\n";
}
+ print "\t\n" .
+ " \n";
+ }
+ print "";
+} elsif ($action eq "log") {
+ my $date = 0;
+ if ($time_back > 0) {
+ $date = time - $time_back*24*60*60;
+ }
+ my $head = git_head($project);
+ open my $fd, "-|", "$gitbin/git-rev-list --max-age=$date $head";
+ my (@revlist) = map { chomp; $_ } <$fd>;
+ close $fd;
+
+ git_header_html();
+ print "\n";
+ print "view ";
+ print $cgi->a({-href => "$my_uri?p=$project;a=log"}, "last day") . " | " .
+ $cgi->a({-href => "$my_uri?p=$project;a=log;t=7"}, "week") . " | " .
+ $cgi->a({-href => "$my_uri?p=$project;a=log;t=31"}, "month") . " | " .
+ $cgi->a({-href => "$my_uri?p=$project;a=log;t=365"}, "year") . " | " .
+ $cgi->a({-href => "$my_uri?p=$project;a=log;t=0"}, "all") . "
\n";
+ print "
\n" .
+ "
\n";
+
+ if (!(@revlist)) {
+ my %co = git_commit($head);
+ print " Last change " . $co{'age_string'} . ".
\n";
}
- if ($action eq "log") {
- git_footer_html();
- } elsif ($action eq "rss") {
- print "";
+
+ foreach my $commit (@revlist) {
+ my %co = git_commit($commit);
+ my %ad = date_str($co{'author_epoch'});
+ print "\n" .
+ $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "title"},
+ "" . $co{'age_string'} . "" . escapeHTML($co{'title'})) . "\n" .
+ "
\n";
+ print "\n" .
+ "
\n" .
+ "view " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " .
+ $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "diff") . "
\n" .
+ "
\n" .
+ "
" . escapeHTML($co{'author_name'}) . " [" . $ad{'rfc2822'} . "]\n" .
+ "
\n" .
+ "\n";
+ my $comment = $co{'comment'};
+ foreach my $line (@$comment) {
+ last if ($line =~ m/^(signed-off|acked)-by:/i);
+ print escapeHTML($line) . "
\n";
+ }
+ print "
\n" .
+ "
\n";
}
+ git_footer_html();
} elsif ($action eq "commit") {
my %co = git_commit($hash);
- if (!defined(%co)) {
+ if (!%co) {
die_error("", "Unknown commit object.");
}
my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
@@ -532,12 +544,12 @@ if ($action eq "blob") {
my @difftree;
if (defined($co{'parent'})) {
- open my $fd, "-|", "$gitbin/diff-tree -r " . $co{'parent'} . " $hash";
+ open my $fd, "-|", "$gitbin/git-diff-tree -r " . $co{'parent'} . " $hash";
@difftree = map { chomp; $_ } <$fd>;
close $fd;
} else {
# fake git-diff-tree output for initial revision
- open my $fd, "-|", "$gitbin/ls-tree -r $hash";
+ open my $fd, "-|", "$gitbin/git-ls-tree -r $hash";
@difftree = map { chomp; "+" . $_ } <$fd>;
close $fd;
}
@@ -664,10 +676,10 @@ if ($action eq "blob") {
git_footer_html();
} elsif ($action eq "commitdiff") {
my %co = git_commit($hash);
- if (!defined(%co)) {
+ if (!%co) {
die_error("", "Unknown commit object.");
}
- open my $fd, "-|", "$gitbin/diff-tree -r " . $co{'parent'} . " $hash";
+ open my $fd, "-|", "$gitbin/git-diff-tree -r " . $co{'parent'} . " $hash";
my (@difftree) = map { chomp; $_ } <$fd>;
close $fd;
@@ -710,7 +722,7 @@ if ($action eq "blob") {
if (!(defined($hash))) {
$hash = git_head($project);
}
- open my $fd, "-|", "$gitbin/rev-list $hash";
+ open my $fd, "-|", "$gitbin/git-rev-list $hash";
my (@revlist) = map { chomp; $_ } <$fd>;
close $fd;
@@ -725,7 +737,7 @@ if ($action eq "blob") {
my $parents = $co{'parents'};
my $found = 0;
foreach my $parent (@$parents) {
- open $fd, "-|", "$gitbin/diff-tree -r $parent $rev $file_name";
+ open $fd, "-|", "$gitbin/git-diff-tree -r $parent $rev $file_name";
my (@difftree) = map { chomp; $_ } <$fd>;
close $fd;