threads / discuss / 43296

git_get_projects_list and $projects_list

Subject: git_get_projects_list and $projects_list

## tl;dr

4 messages between Oct 31, 2006 and Nov 2, 2006.

replies: 3people: 2as markdown or json

Aneesh Kumar· Oct 31, 2006, 11:47 UTC · lore
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);

Jakub Narebski· Oct 31, 2006, 11:59 UTC · re: Aneesh Kumar · lore

Re: git_get_projects_list and $projects_list

Aneesh Kumar wrote:
Show 7 quoted lines
> 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
Jakub Narebski· Oct 31, 2006, 12:23 UTC · re: Jakub Narebski · lore

Re: git_get_projects_list and $projects_list

Jakub Narebski wrote:
Show 12 quoted lines
> 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
Aneesh Kumar· Nov 2, 2006, 04:13 UTC · re: Jakub Narebski · lore

Re: git_get_projects_list and $projects_list

On 10/31/06, Jakub Narebski <jnareb@gmail.com> wrote:
>         $dir =~ s!/+$!!;
>
That works. Attaching the diff below
-aneesh
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({

← back to recent threads