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 formatmaint
commit
dad1a454d5
|
@ -123,6 +123,15 @@ GITWEB_CONFIG file:
|
||||||
$feature{'snapshot'}{'default'} = ['zip', 'tgz'];
|
$feature{'snapshot'}{'default'} = ['zip', 'tgz'];
|
||||||
$feature{'snapshot'}{'override'} = 1;
|
$feature{'snapshot'}{'override'} = 1;
|
||||||
|
|
||||||
|
If you allow overriding for the snapshot feature, you can specify which
|
||||||
|
snapshot formats are globally disabled. You can also add any command line
|
||||||
|
options you want (such as setting the compression level). For instance,
|
||||||
|
you can disable Zip compressed snapshots and set GZip to run at level 6 by
|
||||||
|
adding the following lines to your $GITWEB_CONFIG:
|
||||||
|
|
||||||
|
$known_snapshot_formats{'zip'}{'disabled'} = 1;
|
||||||
|
$known_snapshot_formats{'tgz'}{'compressor'} = ['gzip','-6'];
|
||||||
|
|
||||||
|
|
||||||
Gitweb repositories
|
Gitweb repositories
|
||||||
-------------------
|
-------------------
|
||||||
|
|
|
@ -160,7 +160,8 @@ our %known_snapshot_formats = (
|
||||||
# 'suffix' => filename suffix,
|
# 'suffix' => filename suffix,
|
||||||
# 'format' => --format for git-archive,
|
# 'format' => --format for git-archive,
|
||||||
# 'compressor' => [compressor command and arguments]
|
# 'compressor' => [compressor command and arguments]
|
||||||
# (array reference, optional)}
|
# (array reference, optional)
|
||||||
|
# 'disabled' => boolean (optional)}
|
||||||
#
|
#
|
||||||
'tgz' => {
|
'tgz' => {
|
||||||
'display' => 'tar.gz',
|
'display' => 'tar.gz',
|
||||||
|
@ -176,6 +177,14 @@ our %known_snapshot_formats = (
|
||||||
'format' => 'tar',
|
'format' => 'tar',
|
||||||
'compressor' => ['bzip2']},
|
'compressor' => ['bzip2']},
|
||||||
|
|
||||||
|
'txz' => {
|
||||||
|
'display' => 'tar.xz',
|
||||||
|
'type' => 'application/x-xz',
|
||||||
|
'suffix' => '.tar.xz',
|
||||||
|
'format' => 'tar',
|
||||||
|
'compressor' => ['xz'],
|
||||||
|
'disabled' => 1},
|
||||||
|
|
||||||
'zip' => {
|
'zip' => {
|
||||||
'display' => 'zip',
|
'display' => 'zip',
|
||||||
'type' => 'application/x-zip',
|
'type' => 'application/x-zip',
|
||||||
|
@ -188,6 +197,7 @@ our %known_snapshot_formats = (
|
||||||
our %known_snapshot_format_aliases = (
|
our %known_snapshot_format_aliases = (
|
||||||
'gzip' => 'tgz',
|
'gzip' => 'tgz',
|
||||||
'bzip2' => 'tbz2',
|
'bzip2' => 'tbz2',
|
||||||
|
'xz' => 'txz',
|
||||||
|
|
||||||
# backward compatibility: legacy gitweb config support
|
# backward compatibility: legacy gitweb config support
|
||||||
'x-gzip' => undef, 'gz' => undef,
|
'x-gzip' => undef, 'gz' => undef,
|
||||||
|
@ -494,7 +504,8 @@ sub filter_snapshot_fmts {
|
||||||
exists $known_snapshot_format_aliases{$_} ?
|
exists $known_snapshot_format_aliases{$_} ?
|
||||||
$known_snapshot_format_aliases{$_} : $_} @fmts;
|
$known_snapshot_format_aliases{$_} : $_} @fmts;
|
||||||
@fmts = grep {
|
@fmts = grep {
|
||||||
exists $known_snapshot_formats{$_} } @fmts;
|
exists $known_snapshot_formats{$_} &&
|
||||||
|
!$known_snapshot_formats{$_}{'disabled'}} @fmts;
|
||||||
}
|
}
|
||||||
|
|
||||||
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
|
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
|
||||||
|
@ -5181,6 +5192,8 @@ sub git_snapshot {
|
||||||
die_error(400, "Unknown snapshot format");
|
die_error(400, "Unknown snapshot format");
|
||||||
} elsif (!grep($_ eq $format, @snapshot_fmts)) {
|
} elsif (!grep($_ eq $format, @snapshot_fmts)) {
|
||||||
die_error(403, "Unsupported snapshot format");
|
die_error(403, "Unsupported snapshot format");
|
||||||
|
} elsif ($known_snapshot_formats{$format}{'disabled'}) {
|
||||||
|
die_error(403, "Snapshot format not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined $hash) {
|
if (!defined $hash) {
|
||||||
|
|
Loading…
Reference in New Issue