Subject: Re: [PATCH] gitweb: Fix export check in git_get_projects_list

From: Jakub Narebski <[email-masked]>
Date: Mon, 29 Dec 2008 13:29:25 +0100

On Sun, 28 Dec 2008, Jakub Narebski wrote:
> On Sat, 27 Dec 2008, Devin Doucette wrote:

> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index 8f574c7..99f71b4 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -2147,8 +2147,9 @@ sub git_get_projects_list {
> > 
> >  				my $subdir = substr($File::Find::name, $pfxlen + 1);
> >  				# we check related file in $projectroot
> > -				if (check_export_ok("$projectroot/$filter/$subdir")) {
> > -					push @list, { path => ($filter ? "$filter/" : '') . $subdir };
> > +				my $path = ($filter ? "$filter/" : '') . $subdir;
> 
> Nice and clear, but wouldn't be better to use slightly more effective
> 
> +				my $path = $filter ? "$filter/$subdir" : $subdir;
> 
> Or even, taking care of the case when $filter eq '0'
> 
> +				my $path = defined $filter && $filter ne '' ? "$filter/$subdir" : $subdir;

Err, actually with "$filter ||= '';" earlier in git_get_projects_list
this is not necessary, and is not an improvement.
 
-- 
Jakub Narebski
Poland