summaryrefslogtreecommitdiff
path: root/gitweb/gitweb.perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-08-24 00:19:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-08-24 00:19:06 (GMT)
commitdad1a454d5411a50dc8a51837cf859f40804b776 (patch)
tree2bca46c016ccaddbcacef0878e473bec6028330a /gitweb/gitweb.perl
parentb5a8dc7e066ac739a42f87f64e067d08ff842470 (diff)
parentcbdefb5ac43a1a34e71121a7a6a6434f0b8aa1cf (diff)
downloadgit-dad1a454d5411a50dc8a51837cf859f40804b776.zip
git-dad1a454d5411a50dc8a51837cf859f40804b776.tar.gz
git-dad1a454d5411a50dc8a51837cf859f40804b776.tar.bz2
Merge branch 'mr/gitweb-xz'
* mr/gitweb-xz: gitweb: add support for XZ compressed snapshots gitweb: update INSTALL regarding specific snapshot settings gitweb: support to globally disable a snapshot format
Diffstat (limited to 'gitweb/gitweb.perl')
-rwxr-xr-xgitweb/gitweb.perl17
1 files changed, 15 insertions, 2 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 36cf4a2..d02b7a3 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -160,7 +160,8 @@ our %known_snapshot_formats = (
# 'suffix' => filename suffix,
# 'format' => --format for git-archive,
# 'compressor' => [compressor command and arguments]
- # (array reference, optional)}
+ # (array reference, optional)
+ # 'disabled' => boolean (optional)}
#
'tgz' => {
'display' => 'tar.gz',
@@ -176,6 +177,14 @@ our %known_snapshot_formats = (
'format' => 'tar',
'compressor' => ['bzip2']},
+ 'txz' => {
+ 'display' => 'tar.xz',
+ 'type' => 'application/x-xz',
+ 'suffix' => '.tar.xz',
+ 'format' => 'tar',
+ 'compressor' => ['xz'],
+ 'disabled' => 1},
+
'zip' => {
'display' => 'zip',
'type' => 'application/x-zip',
@@ -188,6 +197,7 @@ our %known_snapshot_formats = (
our %known_snapshot_format_aliases = (
'gzip' => 'tgz',
'bzip2' => 'tbz2',
+ 'xz' => 'txz',
# backward compatibility: legacy gitweb config support
'x-gzip' => undef, 'gz' => undef,
@@ -494,7 +504,8 @@ sub filter_snapshot_fmts {
exists $known_snapshot_format_aliases{$_} ?
$known_snapshot_format_aliases{$_} : $_} @fmts;
@fmts = grep {
- exists $known_snapshot_formats{$_} } @fmts;
+ exists $known_snapshot_formats{$_} &&
+ !$known_snapshot_formats{$_}{'disabled'}} @fmts;
}
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
@@ -5181,6 +5192,8 @@ sub git_snapshot {
die_error(400, "Unknown snapshot format");
} elsif (!grep($_ eq $format, @snapshot_fmts)) {
die_error(403, "Unsupported snapshot format");
+ } elsif ($known_snapshot_formats{$format}{'disabled'}) {
+ die_error(403, "Snapshot format not allowed");
}
if (!defined $hash) {