git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: Fix export check in git_get_projects_list
@ 2008-12-27  9:39 Devin Doucette
  2008-12-28  2:12 ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Devin Doucette @ 2008-12-27  9:39 UTC (permalink / raw)
  To: git; +Cc: Petr Baudis, Jakub Narebski

When $filter was empty, the path passed to check_export_ok would
contain an extra '/', which some implementations of export_auth_hook
are sensitive to.

It makes more sense to fix this here than to handle the special case
in each implementation of export_auth_hook.

Signed-off-by: Devin Doucette <devin@doucette.cc>
---
 gitweb/gitweb.perl |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

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;
+				if (check_export_ok("$projectroot/$path")) {
+					push @list, { path => $path };
 					$File::Find::prune = 1;
 				}
 			},
-- 
1.6.1.rc4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: Fix export check in git_get_projects_list
  2008-12-27  9:39 [PATCH] gitweb: Fix export check in git_get_projects_list Devin Doucette
@ 2008-12-28  2:12 ` Jakub Narebski
  2008-12-28  6:54   ` Junio C Hamano
  2008-12-29 12:29   ` Jakub Narebski
  0 siblings, 2 replies; 4+ messages in thread
From: Jakub Narebski @ 2008-12-28  2:12 UTC (permalink / raw)
  To: Devin Doucette; +Cc: git, Petr Baudis

On Sat, 27 Dec 2008, Devin Doucette wrote:

> When $filter was empty, the path passed to check_export_ok would
> contain an extra '/', which some implementations of export_auth_hook
> are sensitive to.
> 
> It makes more sense to fix this here than to handle the special case
> in each implementation of export_auth_hook.
> 
> Signed-off-by: Devin Doucette <devin@doucette.cc>

Good catch. Thanks.

Acked-by: Jakub Narebski <jnareb@gmail.com>

> ---
>  gitweb/gitweb.perl |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> 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;

> +				if (check_export_ok("$projectroot/$path")) {
> +					push @list, { path => $path };
>  					$File::Find::prune = 1;
>  				}
>  			},
> -- 
> 1.6.1.rc4
> 

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: Fix export check in git_get_projects_list
  2008-12-28  2:12 ` Jakub Narebski
@ 2008-12-28  6:54   ` Junio C Hamano
  2008-12-29 12:29   ` Jakub Narebski
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2008-12-28  6:54 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Devin Doucette, git, Petr Baudis

Jakub Narebski <jnareb@gmail.com> writes:

> On Sat, 27 Dec 2008, Devin Doucette wrote:
>
>> When $filter was empty, the path passed to check_export_ok would
>> contain an extra '/', which some implementations of export_auth_hook
>> are sensitive to.
>> 
>> It makes more sense to fix this here than to handle the special case
>> in each implementation of export_auth_hook.
>> 
>> Signed-off-by: Devin Doucette <devin@doucette.cc>
>
> Good catch. Thanks.

Thanks, both.  Will queue for 'maint'.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: Fix export check in git_get_projects_list
  2008-12-28  2:12 ` Jakub Narebski
  2008-12-28  6:54   ` Junio C Hamano
@ 2008-12-29 12:29   ` Jakub Narebski
  1 sibling, 0 replies; 4+ messages in thread
From: Jakub Narebski @ 2008-12-29 12:29 UTC (permalink / raw)
  To: Devin Doucette; +Cc: git, Petr Baudis

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-29 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-27  9:39 [PATCH] gitweb: Fix export check in git_get_projects_list Devin Doucette
2008-12-28  2:12 ` Jakub Narebski
2008-12-28  6:54   ` Junio C Hamano
2008-12-29 12:29   ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).