gitweb: make search form generate pathinfo-style URLs
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 <hashproduct@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matt McCutchen committed
Jun 28, 2007 at 14:57 UTC
40375a83d2bc3e2c86f998fe47fef573502a9922
1 file changed
+9
-3
gitweb/gitweb.perl
+9
-3
@@ -2213,12 +2213,18 @@ EOF
2213
} else {
2214
$search_hash = "HEAD";
2215
}
2216
+ my $action = $my_uri;
2217
+ my ($use_pathinfo) = gitweb_check_feature('pathinfo');
2218
+ if ($use_pathinfo) {
2219
+ $action .= "/$project";
2220
+ } else {
2221
+ $cgi->param("p", $project);
2222
+ }
2223
$cgi->param("a", "search");
2224
$cgi->param("h", $search_hash);
2218
- $cgi->param("p", $project);
2219
- print $cgi->startform(-method => "get", -action => $my_uri) .
2225
+ print $cgi->startform(-method => "get", -action => $action) .
2226
"<div class=\"search\">\n" .
2221
- $cgi->hidden(-name => "p") . "\n" .
2227
+ (!$use_pathinfo && $cgi->hidden(-name => "p") . "\n") .
2228
$cgi->hidden(-name => "a") . "\n" .
2229
$cgi->hidden(-name => "h") . "\n" .
2230
$cgi->popup_menu(-name => 'st', -default => 'commit',