summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9312944)
raw | patch | inline | side by side (parent: 9312944)
author | Kay Sievers <kay.sievers@suse.de> | |
Wed, 19 Oct 2005 01:18:45 +0000 (03:18 +0200) | ||
committer | Kay Sievers <kay.sievers@suse.de> | |
Wed, 19 Oct 2005 01:18:45 +0000 (03:18 +0200) |
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
gitweb.cgi | patch | blob | history |
diff --git a/gitweb.cgi b/gitweb.cgi
index a11f2974f4596ca84cd9ef63911adced6e75bd8e..873b7ce12ee6892841a9f5cdc372353706fb5f57 100755 (executable)
--- a/gitweb.cgi
+++ b/gitweb.cgi
sub git_header_html {
my $status = shift || "200 OK";
+ my $expires = shift;
my $title = "git";
if (defined $project) {
$title .= "/$action";
}
}
- print $cgi->header(-type=>'text/html', -charset => 'utf-8', -status=> $status);
+ print $cgi->header(-type=>'text/html', -charset => 'utf-8', -status=> $status, -expires => $expires);
print <<EOF;
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
open my $fd, "-|", "$gitbin/git-diff-tree -r -M $root $parent $hash" or die_error(undef, "Open failed.");
@difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
- git_header_html();
+
+ # non-textual hash id's can be cached
+ my $expires;
+ if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
+ $expires = "+1d";
+ }
+ git_header_html(undef, $expires);
print "<div class=\"page_nav\">\n" .
$cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
" | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "shortlog") .
my (@difftree) = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
- git_header_html();
+ # non-textual hash id's can be cached
+ my $expires;
+ if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
+ $expires = "+1d";
+ }
+ git_header_html(undef, $expires);
print "<div class=\"page_nav\">\n" .
$cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
" | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "shortlog") .