@matheusbsbs / matheus-bagliano / commits / 868bc068bb
Fork 0

gitweb: new cgi parameter: opt

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>

Miklos Vajna committed Jul 12, 2007 at 20:39 UTC 868bc068bb45e3b9d135151f2126ce3dba849426
1 file changed +19
gitweb/gitweb.perl
+19
@@ -386,6 +386,23 @@ if (defined $hash_base) {
386 }
387 }
388
389 +my %allowed_options = (
390 + "--no-merges" => [ qw(rss atom log shortlog history) ],
391 +);
392 +
393 +our @extra_options = $cgi->param('opt');
394 +if (defined @extra_options) {
395 + foreach(@extra_options)
396 + {
397 + if (not grep(/^$_$/, keys %allowed_options)) {
398 + die_error(undef, "Invalid option parameter");
399 + }
400 + if (not grep(/^$action$/, @{$allowed_options{$_}})) {
401 + die_error(undef, "Invalid option parameter for this action");
402 + }
403 + }
404 +}
405 +
406 our $hash_parent_base = $cgi->param('hpb');
407 if (defined $hash_parent_base) {
408 if (!validate_refname($hash_parent_base)) {
@@ -537,6 +554,7 @@ sub href(%) {
554 action => "a",
555 file_name => "f",
556 file_parent => "fp",
557 + extra_options => "opt",
558 hash => "h",
559 hash_parent => "hp",
560 hash_base => "hb",
@@ -1773,6 +1791,7 @@ sub parse_commits {
1791 ($arg ? ($arg) : ()),
1792 ("--max-count=" . $maxcount),
1793 ("--skip=" . $skip),
1794 + @extra_options,
1795 $commit_id,
1796 "--",
1797 ($filename ? ($filename) : ())