}
our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
-$project =~ s|^/||; $project =~ s|/$||;
+if (defined $project) {
+ $project =~ s|^/||;
+ $project =~ s|/$||;
+}
if (defined $project && $project) {
if (!validate_input($project)) {
die_error(undef, "Invalid project parameter");
<title>$title</title>
<link rel="stylesheet" type="text/css" href="$stylesheet"/>
EOF
- print "<link rel=\"alternate\" title=\"" . esc_param($project) . " log\" href=\"" .
- "$my_uri?" . esc_param("p=$project;a=rss") . "\" type=\"application/rss+xml\"/>\n" .
- "</head>\n";
+ if (defined $project) {
+ printf('<link rel="alternate" title="%s log" '.
+ 'href="%s" type="application/rss+xml"/>'."\n",
+ esc_param($project),
+ esc_param("$my_uri?p=$project;a=rss"));
+ }
- print "<body>\n" .
+ print "</head>\n" .
+ "<body>\n" .
"<div class=\"page_header\">\n" .
"<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
"<img src=\"$logo\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
if ($page > 0) {
$paging_nav .= " ⋅ " .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$action;h=$hash;pg=" . ($page-1)),
- -accesskey => "p", -title => "Alt-p"}, "prev");
+ -accesskey => "p", -title => "Alt-p"}, "prev");
} else {
$paging_nav .= " ⋅ prev";
}
if ($nrevs >= (100 * ($page+1)-1)) {
$paging_nav .= " ⋅ " .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$action;h=$hash;pg=" . ($page+1)),
- -accesskey => "n", -title => "Alt-n"}, "next");
+ -accesskey => "n", -title => "Alt-n"}, "next");
} else {
$paging_nav .= " ⋅ next";
}
#my $ref = defined $refs ? git_get_referencing($refs, $commit) : '';
my $ref = git_get_referencing($refs, $commit);
my %co = git_read_commit($commit);
- my %ad = date_str($co{'author_epoch'});
if ($alternate) {
print "<tr class=\"dark\">\n";
} else {
git_header_div('summary', $project);
my $taglist = git_read_refs("refs/heads");
- my $alternate = 0;
if (defined @$taglist) {
git_heads_body($taglist, $head);
}
next if !%co;
my %ad = date_str($co{'author_epoch'});
git_header_div('commit',
- "<span class=\"age\">$co{'age_string'}</span>" .
- esc_html($co{'title'}) . $ref,
- $commit);
+ "<span class=\"age\">$co{'age_string'}</span>" .
+ esc_html($co{'title'}) . $ref,
+ $commit);
print "<div class=\"title_text\">\n" .
"<div class=\"log_link\">\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
}
git_header_html(undef, $expires);
git_page_nav('commit', defined $co{'parent'} ? '' : 'commitdiff',
- $hash, $co{'tree'}, $hash,
- $formats_nav);
+ $hash, $co{'tree'}, $hash,
+ $formats_nav);
if (defined $co{'parent'}) {
git_header_div('commitdiff', esc_html($co{'title'}) . $ref, $hash);
sub git_commitdiff_plain {
mkdir($git_temp, 0700);
+ my %co = git_read_commit($hash);
+ if (!%co) {
+ die_error(undef, "Unknown commit object");
+ }
+ if (!defined $hash_parent) {
+ $hash_parent = $co{'parent'} || '--root';
+ }
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed");
my @difftree = map { chomp; $_ } <$fd>;
}
print $cgi->header(-type => "text/plain", -charset => 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
- my %co = git_read_commit($hash);
my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
my $comment = $co{'comment'};
print "From: $co{'author'}\n" .