]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: new cgi parameter: opt
authorMiklos Vajna <redacted>
Thu, 12 Jul 2007 18:39:27 +0000 (20:39 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 1a330835fb9a658982cf41ea82abbdb9dc18c9ffb2fb4cb56af61d69982ab98a..e6142e06a0dbb51c5bd57bbf62e44e0590e5297656ea2f7a07895a585cc057d8 100755 (executable)
@@ -387,6 +387,23 @@ if (defined $hash_base) {
        }
 }
 
+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)) {
@@ -538,6 +555,7 @@ sub href(%) {
                action => "a",
                file_name => "f",
                file_parent => "fp",
+               extra_options => "opt",
                hash => "h",
                hash_parent => "hp",
                hash_base => "hb",
@@ -1774,6 +1792,7 @@ sub parse_commits {
                ($arg ? ($arg) : ()),
                ("--max-count=" . $maxcount),
                ("--skip=" . $skip),
+               @extra_options,
                $commit_id,
                "--",
                ($filename ? ($filename) : ())
This page took 0.221899 seconds and 4 git commands to generate.