Re: [PATCH] gitweb: make search form generate pathinfo-style URLs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Junio C Hamano <gitster@xxxxxxxxx> wrote:

> Matt McCutchen <hashproduct@xxxxxxxxx> writes:
> 
> > 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@xxxxxxxxx>
> > ---
> >  gitweb/gitweb.perl |   12 +++++++++---
> >  1 files changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index f36428e..7b0e110 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -2215,12 +2215,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") .
> 
> Ahhhhh.  (!$use_pathinfo && blah) when $use_pathinfo is true
> evaluates to an empty string, which saves you from protecting
> yourself from undef.  Perhaps clever, but is not terribly nice.
> 
> Other than that, the patch looks sane to me.

Good catch.

    Luben

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux