]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: make search form generate pathinfo-style URLs
authorMatt McCutchen <redacted>
Thu, 28 Jun 2007 18:57:07 +0000 (14:57 -0400)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
The search form generated traditional-style URLs with a "p=" parameter
even when the pathinfo feature was on.  This patch makes it generate
pathinfo-style URLs when appropriate.

Signed-off-by: Matt McCutchen <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index f0e775a092a4e51c6c3f8ed9c492619d28e76adefd35fa806d6239605ac9daeb..3ee147c757409f3f700b4aa998c87af783f64423a66fd85d639708771240be6e 100755 (executable)
@@ -2214,12 +2214,18 @@ EOF
                } else {
                        $search_hash = "HEAD";
                }
+               my $action = $my_uri;
+               my ($use_pathinfo) = gitweb_check_feature('pathinfo');
+               if ($use_pathinfo) {
+                       $action .= "/$project";
+               } else {
+                       $cgi->param("p", $project);
+               }
                $cgi->param("a", "search");
                $cgi->param("h", $search_hash);
-               $cgi->param("p", $project);
-               print $cgi->startform(-method => "get", -action => $my_uri) .
+               print $cgi->startform(-method => "get", -action => $action) .
                      "<div class=\"search\">\n" .
-                     $cgi->hidden(-name => "p") . "\n" .
+                     (!$use_pathinfo && $cgi->hidden(-name => "p") . "\n") .
                      $cgi->hidden(-name => "a") . "\n" .
                      $cgi->hidden(-name => "h") . "\n" .
                      $cgi->popup_menu(-name => 'st', -default => 'commit',
This page took 0.221288 seconds and 4 git commands to generate.