{"thread":{"id":"43523","subject":"Re: [PATCH] gitweb: Remove extra \"/\" in path names for git_get_project_list","startedAt":"2006-11-03T05:11:45Z","lastAt":"2006-11-03T11:18:00Z","messageCount":3,"participants":["Jakub Narebski","Junio C Hamano","Aneesh Kumar K.V"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"297073","messageId":"454ACF91.50601@gmail.com","threadId":"43523","inReplyTo":null,"subject":"[PATCH] gitweb: Remove extra \"/\" in path names for git_get_project_list","fromName":"Aneesh Kumar K.V","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-11-03T05:11:45Z","receivedAt":"2006-11-03T05:11:45Z","isPatch":true,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"\n\n\nWithout this change we get a wrong $pfxlen value and the check_export_ok()\nchecks with with a wrong directory name. Without this patch the below\n$projects_list fails with gitweb\n\n$projects_list = \"/tmp/a/b/\";\n\nSigned-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n---\n gitweb/gitweb.perl |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 7710cc2..a0a9aaf 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-- \n1.4.3.3.gc954-dirty\n\n"},{"id":"295781","messageId":"7vslh1jcji.fsf@assigned-by-dhcp.cox.net","threadId":"43523","inReplyTo":"454ACF91.50601@gmail.com","subject":"Re: [PATCH] gitweb: Remove extra \"/\" in path names for git_get_project_list","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-03T05:59:29Z","receivedAt":"2006-11-03T05:59:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Aneesh Kumar K.V\" <aneesh.kumar@gmail.com> writes:\n\n> Without this change we get a wrong $pfxlen value and the check_export_ok()\n> checks with with a wrong directory name. Without this patch the below\n> $projects_list fails with gitweb\n>\n> $projects_list = \"/tmp/a/b/\";\n>\n> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n\nHmph.  Doesn't this break $projects_list = \"/\", I wonder?\n\n> +\t\t# remove the trailing \"/\"\n> +\t\t$dir =~ s!/+$!!;\n\n"},{"id":"295271","messageId":"eif8gd$6u5$1@sea.gmane.org","threadId":"43523","inReplyTo":"7vslh1jcji.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: Remove extra \"/\" in path names for git_get_project_list","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-03T11:18:00Z","receivedAt":"2006-11-03T11:18:00Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> \"Aneesh Kumar K.V\" <aneesh.kumar@gmail.com> writes:\n> \n>> Without this change we get a wrong $pfxlen value and the check_export_ok()\n>> checks with with a wrong directory name. Without this patch the below\n>> $projects_list fails with gitweb\n>>\n>> $projects_list = \"/tmp/a/b/\";\n>>\n>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n> \n> Hmph.  Doesn't this break $projects_list = \"/\", I wonder?\n> \n>> +            # remove the trailing \"/\"\n>> +            $dir =~ s!/+$!!;\n\nSo perhaps\n\n        $dir =~ s!(?<=[^/])/+$!!;\n\n(zero-width positive look-behind assertion).\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"}]}