Skip to content

Commit

Permalink
gitweb: new cgi parameter: opt
Browse files Browse the repository at this point in the history
Currently the only supported value is '--no-merges' for the 'rss', 'atom',
'log', 'shortlog' and 'history' actions, but it can be easily extended to allow
other parameters for other actions.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Miklos Vajna authored and Junio C Hamano committed Jul 12, 2007
1 parent 248c648 commit 868bc06
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,23 @@ sub check_export_ok {
}
}

my %allowed_options = (
"--no-merges" => [ qw(rss atom log shortlog history) ],
);

our @extra_options = $cgi->param('opt');
if (defined @extra_options) {
foreach(@extra_options)
{
if (not grep(/^$_$/, keys %allowed_options)) {
die_error(undef, "Invalid option parameter");
}
if (not grep(/^$action$/, @{$allowed_options{$_}})) {
die_error(undef, "Invalid option parameter for this action");
}
}
}

our $hash_parent_base = $cgi->param('hpb');
if (defined $hash_parent_base) {
if (!validate_refname($hash_parent_base)) {
Expand Down Expand Up @@ -537,6 +554,7 @@ (%)
action => "a",
file_name => "f",
file_parent => "fp",
extra_options => "opt",
hash => "h",
hash_parent => "hp",
hash_base => "hb",
Expand Down Expand Up @@ -1773,6 +1791,7 @@ sub parse_commits {
($arg ? ($arg) : ()),
("--max-count=" . $maxcount),
("--skip=" . $skip),
@extra_options,
$commit_id,
"--",
($filename ? ($filename) : ())
Expand Down

0 comments on commit 868bc06

Please sign in to comment.