exit;
}
+sub git_page_nav {
+ my ($current, $suppress, $head, $treehead, $treebase, $extra) = @_;
+ $extra = '' if !defined $extra; # pager or formats
+
+ my @navs = qw(summary shortlog log commit commitdiff tree);
+ if ($suppress) {
+ @navs = grep { $_ ne $suppress } @navs;
+ }
+
+ my %arg = map { $_, ''} @navs;
+ if (defined $head) {
+ for (qw(commit commitdiff)) {
+ $arg{$_} = ";h=$head";
+ }
+ if ($current =~ m/^(tree | log | shortlog | commit | commitdiff | search)$/x) {
+ for (qw(shortlog log)) {
+ $arg{$_} = ";h=$head";
+ }
+ }
+ }
+ $arg{tree} .= ";h=$treehead" if defined $treehead;
+ $arg{tree} .= ";hb=$treebase" if defined $treebase;
+
+ print "<div class=\"page_nav\">\n" .
+ (join " | ",
+ map { $_ eq $current
+ ? $_
+ : $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$_$arg{$_}")}, "$_")
+ }
+ @navs);
+ print "<br/>$extra<br/>\n" .
+ "</div>\n";
+}
+
sub git_get_type {
my $hash = shift;
"</table>\n";
open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_read_head($project)
or die_error(undef, "Open git-rev-list failed.");
- my (@revlist) = map { chomp; $_ } <$fd>;
+ my @revlist = map { chomp; $_ } <$fd>;
close $fd;
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog"), -class => "title"}, "shortlog") .
$/ = "\0";
open my $fd, "-|", $GIT, "ls-tree", '-z', $hash
or die_error(undef, "Open git-ls-tree failed.");
- chomp (my (@entries) = <$fd>);
+ my @entries = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading tree failed.");
$/ = "\n";
# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
open my $fd, "-|", $GIT, "rev-list", "--max-count=150", git_read_head($project)
or die_error(undef, "Open git-rev-list failed.");
- my (@revlist) = map { chomp; $_ } <$fd>;
+ my @revlist = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading rev-list failed.");
print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
or die_error(undef, "Open git-rev-list failed.");
- my (@revlist) = map { chomp; $_ } <$fd>;
+ my @revlist = map { chomp; $_ } <$fd>;
close $fd;
if ($hash ne $head || $page) {
my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
- my @difftree;
my $parent = $co{'parent'};
if (!defined $parent) {
$parent = "--root";
}
open my $fd, "-|", $GIT, "diff-tree", '-r', '-M', $parent, $hash
or die_error(undef, "Open git-diff-tree failed.");
- @difftree = map { chomp; $_ } <$fd>;
+ my @difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading git-diff-tree failed.");
# non-textual hash id's can be cached
}
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed.");
- my (@difftree) = map { chomp; $_ } <$fd>;
+ my @difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
# non-textual hash id's can be cached
mkdir($git_temp, 0700);
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed.");
- my (@difftree) = map { chomp; $_ } <$fd>;
+ my @difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
# try to figure out the next tag after this commit
my $tagname;
my $refs = read_info_ref("tags");
open $fd, "-|", $GIT, "rev-list", "HEAD";
- chomp (my (@commits) = <$fd>);
+ my @commits = map { chomp; $_ } <$fd>;
close $fd;
foreach my $commit (@commits) {
if (defined $refs->{$commit}) {
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
or die_error(undef, "Open git-rev-list failed.");
- my (@revlist) = map { chomp; $_ } <$fd>;
+ my @revlist = map { chomp; $_ } <$fd>;
close $fd;
if ($hash ne $head || $page) {