{"thread":{"id":"43296","subject":"git_get_projects_list and $projects_list","startedAt":"2006-10-31T11:47:58Z","lastAt":"2006-11-02T04:13:37Z","messageCount":4,"participants":["Aneesh Kumar","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"294258","messageId":"cc723f590610310347h58cdd69bse6d96b19479a4f6a@mail.gmail.com","threadId":"43296","inReplyTo":null,"subject":"git_get_projects_list and $projects_list","fromName":"Aneesh Kumar","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-10-31T11:47:58Z","receivedAt":"2006-10-31T11:47:58Z","isPatch":false,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"Ok if i have\n\n$projects_list = \"/a/git////\" ==> ending \"/\" . the function will fail\nat check_export_ok()\n\n\nThat is because we get the $pfxlen wrong. We should ignore all the trailing \"/\"\nmy $subdir = substr($File::Find::name, $pfxlen + 1);\n\n\n"},{"id":"297975","messageId":"ei7dq4$828$1@sea.gmane.org","threadId":"43296","inReplyTo":"cc723f590610310347h58cdd69bse6d96b19479a4f6a@mail.gmail.com","subject":"Re: git_get_projects_list and $projects_list","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-31T11:59:11Z","receivedAt":"2006-10-31T11:59:11Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Aneesh Kumar wrote:\n\n> Ok if i have\n> \n> $projects_list = \"/a/git////\" ==> ending \"/\" . the function will fail\n> at check_export_ok()\n> \n> That is because we get the $pfxlen wrong. We should ignore all the trailing \"/\"\n> my $subdir = substr($File::Find::name, $pfxlen + 1);\n\nPerhaps it would be enough to just add \n        $dir =~ s!/+$//; \nbefore  \n        my $pfxlen = length(\"$dir\");\n(or something equivalent). Try it and send us a patch.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"298266","messageId":"ei7f7o$bgi$1@sea.gmane.org","threadId":"43296","inReplyTo":"ei7dq4$828$1@sea.gmane.org","subject":"Re: git_get_projects_list and $projects_list","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-31T12:23:32Z","receivedAt":"2006-10-31T12:23:32Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jakub Narebski wrote:\n\n> Aneesh Kumar wrote:\n> \n>> Ok if i have\n>> \n>> $projects_list = \"/a/git////\" ==> ending \"/\" . the function will fail\n>> at check_export_ok()\n>> \n>> That is because we get the $pfxlen wrong. We should ignore all the trailing \"/\"\n>> my $subdir = substr($File::Find::name, $pfxlen + 1);\n> \n> Perhaps it would be enough to just add \n>         $dir =~ s!/+$//; \n\nOoops, it should of course be\n\n        $dir =~ s!/+$!!;\n\n> before  \n>         my $pfxlen = length(\"$dir\");\n> (or something equivalent). Try it and send us a patch.\n\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"297471","messageId":"cc723f590611012013v1359efb9qdb5888fc458da22@mail.gmail.com","threadId":"43296","inReplyTo":"ei7f7o$bgi$1@sea.gmane.org","subject":"Re: git_get_projects_list and $projects_list","fromName":"Aneesh Kumar","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-11-02T04:13:37Z","receivedAt":"2006-11-02T04:13:37Z","isPatch":false,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"On 10/31/06, Jakub Narebski <jnareb@gmail.com> wrote:\n\n>         $dir =~ s!/+$!!;\n>\n\nThat works. Attaching the diff below\n\n-aneesh\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex bf5f829..4343450 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -897,6 +897,8 @@ sub git_get_projects_list {\n \tif (-d $projects_list) {\n \t\t# search in directory\n \t\tmy $dir = $projects_list;\n+\t\t# remove the trailing \"/\"\n+\t\t$dir =~ s!/+$!!;\n \t\tmy $pfxlen = length(\"$dir\");\n \n \t\tFile::Find::find({\n"}]}