git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git_get_projects_list and $projects_list
@ 2006-10-31 11:47 Aneesh Kumar
  2006-10-31 11:59 ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Aneesh Kumar @ 2006-10-31 11:47 UTC (permalink / raw)
  To: Git Mailing List

Ok if i have

$projects_list = "/a/git////" ==> ending "/" . the function will fail
at check_export_ok()


That is because we get the $pfxlen wrong. We should ignore all the trailing "/"
my $subdir = substr($File::Find::name, $pfxlen + 1);



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

* Re: git_get_projects_list and $projects_list
  2006-10-31 11:47 git_get_projects_list and $projects_list Aneesh Kumar
@ 2006-10-31 11:59 ` Jakub Narebski
  2006-10-31 12:23   ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2006-10-31 11:59 UTC (permalink / raw)
  To: git

Aneesh Kumar wrote:

> Ok if i have
> 
> $projects_list = "/a/git////" ==> ending "/" . the function will fail
> at check_export_ok()
> 
> That is because we get the $pfxlen wrong. We should ignore all the trailing "/"
> my $subdir = substr($File::Find::name, $pfxlen + 1);

Perhaps it would be enough to just add 
        $dir =~ s!/+$//; 
before  
        my $pfxlen = length("$dir");
(or something equivalent). Try it and send us a patch.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


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

* Re: git_get_projects_list and $projects_list
  2006-10-31 11:59 ` Jakub Narebski
@ 2006-10-31 12:23   ` Jakub Narebski
  2006-11-02  4:13     ` Aneesh Kumar
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2006-10-31 12:23 UTC (permalink / raw)
  To: git

Jakub Narebski wrote:

> Aneesh Kumar wrote:
> 
>> Ok if i have
>> 
>> $projects_list = "/a/git////" ==> ending "/" . the function will fail
>> at check_export_ok()
>> 
>> That is because we get the $pfxlen wrong. We should ignore all the trailing "/"
>> my $subdir = substr($File::Find::name, $pfxlen + 1);
> 
> Perhaps it would be enough to just add 
>         $dir =~ s!/+$//; 

Ooops, it should of course be

        $dir =~ s!/+$!!;

> before  
>         my $pfxlen = length("$dir");
> (or something equivalent). Try it and send us a patch.


-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


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

* Re: git_get_projects_list and $projects_list
  2006-10-31 12:23   ` Jakub Narebski
@ 2006-11-02  4:13     ` Aneesh Kumar
  0 siblings, 0 replies; 4+ messages in thread
From: Aneesh Kumar @ 2006-11-02  4:13 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 131 bytes --]

On 10/31/06, Jakub Narebski <jnareb@gmail.com> wrote:

>         $dir =~ s!/+$!!;
>

That works. Attaching the diff below

-aneesh

[-- Attachment #2: gitweb.diff --]
[-- Type: text/x-patch, Size: 367 bytes --]

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index bf5f829..4343450 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -897,6 +897,8 @@ sub git_get_projects_list {
 	if (-d $projects_list) {
 		# search in directory
 		my $dir = $projects_list;
+		# remove the trailing "/"
+		$dir =~ s!/+$!!;
 		my $pfxlen = length("$dir");
 
 		File::Find::find({

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

end of thread, other threads:[~2006-11-02  4:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-31 11:47 git_get_projects_list and $projects_list Aneesh Kumar
2006-10-31 11:59 ` Jakub Narebski
2006-10-31 12:23   ` Jakub Narebski
2006-11-02  4:13     ` Aneesh Kumar

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).