{"thread":{"id":"23145","subject":"[PATCH] gitweb: readme fixed regarding per user project root repository","startedAt":"2010-03-22T22:15:29Z","lastAt":"2010-03-29T22:34:03Z","messageCount":7,"participants":["Sylvain Rabot","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"137590","messageId":"1269296130-2237-1-git-send-email-sylvain@abstraction.fr","threadId":"23145","inReplyTo":null,"subject":"[PATCH] gitweb: readme fixed regarding per user project root repository","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-03-22T22:15:29Z","receivedAt":"2010-03-22T22:15:29Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"This is a small modification of the patch I sent (Message-ID: <1267488297-10415-1-git-send-email-sylvain@abstraction.fr>) not yet applied, as far as I have seen.\n\nIt includes a fix for a rewrite rule wich was working but not useable, an update to make another one better and some typos fixes.\n\nRegards.\n\n--\nSylvain\n"},{"id":"137591","messageId":"1269296130-2237-2-git-send-email-sylvain@abstraction.fr","threadId":"23145","inReplyTo":"1269296130-2237-1-git-send-email-sylvain@abstraction.fr","subject":"[PATCH] gitweb: readme fixed regarding per user project root repository","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-03-22T22:15:30Z","receivedAt":"2010-03-22T22:15:30Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"+ the RewriteRule '/+<user>' is not working as the '+' character is\n  replaced by a space in urls when you click on links. it is replaced by '/u/<user>'\n+ the RewriteRule '/user/<user>' updated to allow\n  '/user/<user>', '/user/<user>/' and '/user/<user>/gitweb.cgi'\n+ some typos fixed\n\nSigned-off-by: Sylvain Rabot <sylvain@abstraction.fr>\n---\n gitweb/README |   22 +++++++++++-----------\n 1 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/gitweb/README b/gitweb/README\nindex ad6a04c..bc90f4d 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -347,18 +347,18 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file:\n   $home_link = \"/\";\n \n \n-Webserver configuration with multiple projects' root\n-----------------------------------------------------\n+Webserver configuration with multiple project roots\n+---------------------------------------------------\n \n-If you want to use gitweb with several project roots you can edit your apache\n-virtual host and gitweb.conf configuration files like this :\n+If you want to use gitweb with several project roots then you can edit your\n+apache virtual host and gitweb.conf configuration files like this :\n \n virtual host configuration :\n \n <VirtualHost *:80>\n-    ServerName\t\t\tgit.example.org\n-    DocumentRoot\t\t/pub/git\n-    SetEnv\t\t\t\tGITWEB_CONFIG\t/etc/gitweb.conf\n+    ServerName\t\tgit.example.org\n+    DocumentRoot\t/pub/git\n+    SetEnv\t\tGITWEB_CONFIG\t/etc/gitweb.conf\n \n     # turning on mod rewrite\n     RewriteEngine on\n@@ -368,13 +368,13 @@ virtual host configuration :\n \n     # look for a public_git folder in unix users' home\n     # http://git.example.org/~<user>/\n-    RewriteRule ^/\\~([^\\/]+)(/|/gitweb.cgi)?$\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n+    RewriteRule ^/\\~([^\\/]+)(/|/gitweb.cgi)?$\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n \n-    # http://git.example.org/+<user>/\n-    #RewriteRule ^/\\+([^\\/]+)(/|/gitweb.cgi)?$\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n+    # http://git.example.org/u/<user>/\n+    #RewriteRule ^/\\+([^\\/]+)(/|/gitweb.cgi)?$\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n \n     # http://git.example.org/user/<user>/\n-    #RewriteRule ^/user/([^\\/]+)/(gitweb.cgi)?$\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n+    #RewriteRule ^/user/([^\\/]+)(/|/gitweb.cgi)?$\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n \n     # defined list of project roots\n     RewriteRule ^/scm(/|/gitweb.cgi)?$\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/pub/scm/,L,PT]\n-- \n1.7.0.3\n"},{"id":"137880","messageId":"7v39zmnceq.fsf@alter.siamese.dyndns.org","threadId":"23145","inReplyTo":"1269296130-2237-2-git-send-email-sylvain@abstraction.fr","subject":"Re: [PATCH] gitweb: readme fixed regarding per user project root repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-26T18:52:29Z","receivedAt":"2010-03-26T18:52:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I was waiting for gitweb people to respond, but nobody seems to be\ninterested so here is my take on it.\n\nSylvain Rabot <sylvain@abstraction.fr> writes:\n\n> + the RewriteRule '/+<user>' is not working as the '+' character is\n>   replaced by a space in urls when you click on links. it is replaced by '/u/<user>'\n\nI think the _only_ value of having this example, in addition to the next\none that uses \"http://host/user/<me>\" notation, was to demonstrate that\nyou do not necessarily have the actual user name and the magic token (be\nit \"user\" or \"u\") that introduces the per-user hierarchy as separate path\ncomponents delimited with a slash.  Changing \"+<me>\" to \"u/<me>\" removes\nthat only additional value from this example.\n\nAnybody moderately intelligent would be able to guess \"u/<me>\" if she\nfinds \"user/<me>\" too long to her taste, so I would suggest updating the\nexample to allow \"http://host/+<user>/\" but spell the rewrite rule in such\na way that actually does work.  An alternative is to just remove it.\n\nBy the way, does mod-rewrite configuration allow \"~<me>\" (home-directory\nexpansion) when setting the environment?  You currently do:\n\n    E=GITWEB_PROJECTROOT:/home/$1/public_git/\n\nbut if we somehow could write it like\n\n    E=GITWEB_PROJECTROOT:~$1/public_git/\n\nit would be more generally useful, no?\n\n> + the RewriteRule '/user/<user>' updated to allow\n>   '/user/<user>', '/user/<user>/' and '/user/<user>/gitweb.cgi'\n\nPlease describe what you added relative to the original, not just what the\nfinal result looks like.  \"updated to allow A B C\" doesn't tell the reader\n\"it used to redirect only A and C to gitweb request, but B wasn't\nrewritten.\", which seems to be the case if I am reading your regexp\ncorrectly.  Describing why it is better to also rewrite B would be a good\nidea, too, if it is not obvious.\n\n> + some typos fixed\n>\n> Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>\n\n> diff --git a/gitweb/README b/gitweb/README\n> index ad6a04c..bc90f4d 100644\n> --- a/gitweb/README\n> +++ b/gitweb/README\n> @@ -347,18 +347,18 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file:\n>    $home_link = \"/\";\n>  \n>  \n> -Webserver configuration with multiple projects' root\n> -----------------------------------------------------\n> +Webserver configuration with multiple project roots\n> +---------------------------------------------------\n\nOk.\n\n> -If you want to use gitweb with several project roots you can edit your apache\n> -virtual host and gitweb.conf configuration files like this :\n> +If you want to use gitweb with several project roots then you can edit your\n> +apache virtual host and gitweb.conf configuration files like this :\n\nOk (you might want to remove SP before colon, though).\n\n>  virtual host configuration :\n>  \n>  <VirtualHost *:80>\n> -    ServerName\t\t\tgit.example.org\n> -    DocumentRoot\t\t/pub/git\n> -    SetEnv\t\t\t\tGITWEB_CONFIG\t/etc/gitweb.conf\n> +    ServerName\t\tgit.example.org\n> +    DocumentRoot\t/pub/git\n> +    SetEnv\t\tGITWEB_CONFIG\t/etc/gitweb.conf\n\nWhat is this reindentation for?  \"Just cosmetic\" is an acceptable answer\nas long as the change resulted in cosmetic improvement, but it doesn't\nseem to be cosmetic improvement, either.\n\nThanks.\n"},{"id":"138130","messageId":"1269895395.3392.21.camel@kheops","threadId":"23145","inReplyTo":"7v39zmnceq.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] gitweb: readme fixed regarding per user project root repository","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-03-29T20:43:15Z","receivedAt":"2010-03-29T20:43:15Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"On Fri, 2010-03-26 at 11:52 -0700, Junio C Hamano wrote: \n> I was waiting for gitweb people to respond, but nobody seems to be\n> interested so here is my take on it.\n> \n> Sylvain Rabot <sylvain@abstraction.fr> writes:\n> \n> > + the RewriteRule '/+<user>' is not working as the '+' character is\n> >   replaced by a space in urls when you click on links. it is replaced by '/u/<user>'\n> \n> I think the _only_ value of having this example, in addition to the next\n> one that uses \"http://host/user/<me>\" notation, was to demonstrate that\n> you do not necessarily have the actual user name and the magic token (be\n> it \"user\" or \"u\") that introduces the per-user hierarchy as separate path\n> components delimited with a slash.  Changing \"+<me>\" to \"u/<me>\" removes\n> that only additional value from this example.\n> \n> Anybody moderately intelligent would be able to guess \"u/<me>\" if she\n> finds \"user/<me>\" too long to her taste, so I would suggest updating the\n> example to allow \"http://host/+<user>/\" but spell the rewrite rule in such\n> a way that actually does work.  An alternative is to just remove it.\n> \n\nThe problem is http://host/+user works but then, when you click on a\nlink you will be redirected to :\n\n\"http://host/ user?p=git/git.git;a=tree\" \n-------------^\n\nI will try to look into gitweb.perl to see if the url encoding can be\nupdated smoothly without breaking anything to accept the '+' otherwise I\nthink removing this example would be the right decision like you\nsuggested.\n\n> By the way, does mod-rewrite configuration allow \"~<me>\" (home-directory\n> expansion) when setting the environment?  You currently do:\n> \n>     E=GITWEB_PROJECTROOT:/home/$1/public_git/\n> \n> but if we somehow could write it like\n> \n>     E=GITWEB_PROJECTROOT:~$1/public_git/\n> \n> it would be more generally useful, no?\n\nI looked and I don't think so, ~user/public_git/ is not evaluated by\napache. Maybe it possible to evaluate it in the perl side, I will look\ninto it also.\n\n> \n> > + the RewriteRule '/user/<user>' updated to allow\n> >   '/user/<user>', '/user/<user>/' and '/user/<user>/gitweb.cgi'\n> \n> Please describe what you added relative to the original, not just what the\n> final result looks like.  \"updated to allow A B C\" doesn't tell the reader\n> \"it used to redirect only A and C to gitweb request, but B wasn't\n> rewritten.\", which seems to be the case if I am reading your regexp\n> correctly.  Describing why it is better to also rewrite B would be a good\n> idea, too, if it is not obvious.\n\nWill do.\n\n> \n> > + some typos fixed\n> >\n> > Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>\n> \n> > diff --git a/gitweb/README b/gitweb/README\n> > index ad6a04c..bc90f4d 100644\n> > --- a/gitweb/README\n> > +++ b/gitweb/README\n> > @@ -347,18 +347,18 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file:\n> >    $home_link = \"/\";\n> >  \n> >  \n> > -Webserver configuration with multiple projects' root\n> > -----------------------------------------------------\n> > +Webserver configuration with multiple project roots\n> > +---------------------------------------------------\n> \n> Ok.\n> \n> > -If you want to use gitweb with several project roots you can edit your apache\n> > -virtual host and gitweb.conf configuration files like this :\n> > +If you want to use gitweb with several project roots then you can edit your\n> > +apache virtual host and gitweb.conf configuration files like this :\n> \n> Ok (you might want to remove SP before colon, though).\n\nMy bad, French habit, but, according to wikipedia it is also English\n\"compliant\" (http://en.wikipedia.org/wiki/Colon_%28punctuation%\n29#Spacing). As you want.\n\n> \n> >  virtual host configuration :\n> >  \n> >  <VirtualHost *:80>\n> > -    ServerName\t\t\tgit.example.org\n> > -    DocumentRoot\t\t/pub/git\n> > -    SetEnv\t\t\t\tGITWEB_CONFIG\t/etc/gitweb.conf\n> > +    ServerName\t\tgit.example.org\n> > +    DocumentRoot\t/pub/git\n> > +    SetEnv\t\tGITWEB_CONFIG\t/etc/gitweb.conf\n> \n> What is this reindentation for?  \"Just cosmetic\" is an acceptable answer\n> as long as the change resulted in cosmetic improvement, but it doesn't\n> seem to be cosmetic improvement, either.\n\nThat was the case, it looked better in vim.\n\n> \n> Thanks.\n\n\n-- \nSylvain Rabot <sylvain@abstraction.fr>\n"},{"id":"138136","messageId":"1269902043-11134-1-git-send-email-sylvain@abstraction.fr","threadId":"23145","inReplyTo":"7v39zmnceq.fsf@alter.siamese.dyndns.org","subject":"[PATCH 0/2] gitweb: updates regaring pêr user project root directory","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-03-29T22:34:01Z","receivedAt":"2010-03-29T22:34:01Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"Patches resent to take care Junio's suggestions.\n\nThe first patch is quick and dirty. Although after quick tests it seems\nto not break anything, gitweb maintainers approval is needed.\n\nRegards\n\n--\nSylvain\n"},{"id":"138138","messageId":"1269902043-11134-2-git-send-email-sylvain@abstraction.fr","threadId":"23145","inReplyTo":"1269902043-11134-1-git-send-email-sylvain@abstraction.fr","subject":"[PATCH 1/2] gitweb: dirty patch to make url rewriting involving '+' working","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-03-29T22:34:02Z","receivedAt":"2010-03-29T22:34:02Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"CGI::url method replaces '+' character by '%20', this patch reverts\nthis behavior to make url rewriting involving '+' in the base url working\n\nSigned-off-by: Sylvain Rabot <sylvain@abstraction.fr>\n---\n gitweb/gitweb.perl |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex a2d2283..486996e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -33,6 +33,10 @@ our $version = \"++GIT_VERSION++\";\n our $my_url = $cgi->url();\n our $my_uri = $cgi->url(-absolute => 1);\n \n+# dirty patch to make url rewriting with '+' character working\n+$my_url =~ s/(.*)%20(.*)/$1+$2/g;\n+$my_uri =~ s/(.*)%20(.*)/$1+$2/g;\n+\n # Base URL for relative URLs in gitweb ($logo, $favicon, ...),\n # needed and used only for URLs with nonempty PATH_INFO\n our $base_url = $my_url;\n-- \n1.7.0.3\n"},{"id":"138137","messageId":"1269902043-11134-3-git-send-email-sylvain@abstraction.fr","threadId":"23145","inReplyTo":"1269902043-11134-2-git-send-email-sylvain@abstraction.fr","subject":"[PATCH 2/2] gitweb: readme fixed regarding per user project root repository","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-03-29T22:34:03Z","receivedAt":"2010-03-29T22:34:03Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"- the rewrite rules '/user/<user>' and '/+<user>' have been updated to also allow\n  '/user/<user>/', '/user/<user>/gitweb.cgi', '/+<user>/' and '/+<user>/gitweb.cgi'\n- some typos fixed\n\nSigned-off-by: Sylvain Rabot <sylvain@abstraction.fr>\n---\n gitweb/README |   26 +++++++++++++-------------\n 1 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/gitweb/README b/gitweb/README\nindex ad6a04c..63e5f2e 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -347,38 +347,38 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file:\n   $home_link = \"/\";\n \n \n-Webserver configuration with multiple projects' root\n-----------------------------------------------------\n+Webserver configuration with multiple project roots\n+---------------------------------------------------\n \n-If you want to use gitweb with several project roots you can edit your apache\n-virtual host and gitweb.conf configuration files like this :\n+If you want to use gitweb with several project roots then you can edit your\n+apache virtual host and gitweb.conf configuration files like this :\n \n virtual host configuration :\n \n <VirtualHost *:80>\n-    ServerName\t\t\tgit.example.org\n-    DocumentRoot\t\t/pub/git\n-    SetEnv\t\t\t\tGITWEB_CONFIG\t/etc/gitweb.conf\n+    ServerName\t\tgit.example.org\n+    DocumentRoot\t/pub/git\n+    SetEnv\t\tGITWEB_CONFIG\t/etc/gitweb.conf\n \n     # turning on mod rewrite\n     RewriteEngine on\n \n     # make the front page an internal rewrite to the gitweb script\n-    RewriteRule ^/$ \t\t/cgi-bin/gitweb.cgi [QSA,L,PT]\n+    RewriteRule ^/$\t\t\t\t\t/cgi-bin/gitweb.cgi [QSA,L,PT]\n \n     # look for a public_git folder in unix users' home\n     # http://git.example.org/~<user>/\n-    RewriteRule ^/\\~([^\\/]+)(/|/gitweb.cgi)?$\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n+    RewriteRule ^/\\~([^\\/]+)(/|/gitweb.cgi)?$\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n \n     # http://git.example.org/+<user>/\n-    #RewriteRule ^/\\+([^\\/]+)(/|/gitweb.cgi)?$\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n+    #RewriteRule ^/\\+([^\\/]+)(/|/gitweb.cgi)?$\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n \n     # http://git.example.org/user/<user>/\n-    #RewriteRule ^/user/([^\\/]+)/(gitweb.cgi)?$\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n+    #RewriteRule ^/user/([^\\/]+)(/|/gitweb.cgi)?$\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\n \n     # defined list of project roots\n-    RewriteRule ^/scm(/|/gitweb.cgi)?$\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/pub/scm/,L,PT]\n-    RewriteRule ^/var(/|/gitweb.cgi)?$\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/var/git/,L,PT]\n+    RewriteRule ^/scm(/|/gitweb.cgi)?$\t\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/pub/scm/,L,PT]\n+    RewriteRule ^/var(/|/gitweb.cgi)?$\t\t\t/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/var/git/,L,PT]\n \n     # make access for \"dumb clients\" work\n     RewriteRule ^/(.*\\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI}  [L,PT]\n-- \n1.7.0.3\n"}]}