git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Make Gitweb behave like Apache mod_userdir
@ 2009-11-15 10:04 Sylvain Rabot
  2009-11-15 21:03 ` Junio C Hamano
  2009-11-17 20:15 ` Junio C Hamano
  0 siblings, 2 replies; 18+ messages in thread
From: Sylvain Rabot @ 2009-11-15 10:04 UTC (permalink / raw)
  To: git

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

Hello,

I contact you because I spent quite some time to make something pretty
basic with gitweb.
I made gitweb behave a bit like UserDir module will in apache.
In fact it's only configuration but I think it could be useful to others.

Basicly it allows users of your server who use git to be able to use
gitweb to browse their own root project. E.G. :

Alice's private repos :

/home/alice/git/product_a.git (cloned from /var/git/product_a.git)
/home/alice/git/product_b.git (cloned from /var/git/product_b.git)
/home/alice/git/product_c.git (cloned from /var/git/product_c.git)

Alice's links to her repos which she wants to be able to browse with gitweb :

/home/alice/gitweb/product_a -> /home/alice/git/product_a.git/.git
/home/alice/gitweb/product_c -> /home/alice/git/product_c.git/.git

Bare repos :

/var/git/product_a.git
/var/git/product_b.git
/var/git/product_c.git
/var/git/product_d.git

/etc/gitweb.conf :

$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/git/";

Apache configuration :

RewriteRule ^/~([^\/]+)/?$  /cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]

So now all users with a gitweb folder in their home will be able to
browse all git repos in it through http://<host>/~<user>.

You will find a patch enclosed which try to describe best what I did
and why in the gitweb/README.

Regards.

[-- Attachment #2: userdirstyle.patch --]
[-- Type: application/octet-stream, Size: 1490 bytes --]

diff --git a/gitweb/README b/gitweb/README
index 66c6a93..6f733e6 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -306,8 +306,10 @@ repositories, you can configure apache like this:
     DocumentRoot /pub/git
     SetEnv	GITWEB_CONFIG	/etc/gitweb.conf
     RewriteEngine on
+
     # make the front page an internal rewrite to the gitweb script
     RewriteRule ^/$  /cgi-bin/gitweb.cgi
+
     # make access for "dumb clients" work
     RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI}  [L,PT]
 </VirtualHost>
@@ -332,6 +334,20 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file:
   $my_uri = "/";
   $home_link = "/";
 
+If you want gitweb to act a bit like UserDir mod in apache, knowing, http://<host>/~<user> 
+will list all git repos of <user> located in a special directory in his home (/home/<user>/gitweb/), 
+do the following steps :
+
+Add this to the VirtualHost section of your apache configuration file :
+
+   RewriteRule ^/~([^\/]+)/?$  /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]
+
+Modify your gitweb.conf file, located at /etc/gitweb.conf in this example, with :
+
+   $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/path/to/the/defaul/project/root"; 
+
+Thus, each user with a gitweb folder in his home will be able to browse it with gitweb.
+/!\ The gitweb folder and user's home folder must be readable by the webserver user.
 
 PATH_INFO usage
 -----------------------

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-15 10:04 Make Gitweb behave like Apache mod_userdir Sylvain Rabot
@ 2009-11-15 21:03 ` Junio C Hamano
  2009-11-17 13:58   ` Jakub Narebski
  2009-11-17 20:15 ` Junio C Hamano
  1 sibling, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2009-11-15 21:03 UTC (permalink / raw)
  To: Jakub Narebski, Petr Baudis, Luben Tuikov, J.H.; +Cc: git, Sylvain Rabot

Sylvain Rabot <sylvain@abstraction.fr> writes:

> I made gitweb behave a bit like UserDir module will in apache.
> In fact it's only configuration but I think it could be useful to others.

Thanks.  Any comment from gitweb gangs?

> Basicly it allows users of your server who use git to be able to use
> gitweb to browse their own root project. E.G. :
>
> Alice's private repos :
>
> /home/alice/git/product_a.git (cloned from /var/git/product_a.git)
> /home/alice/git/product_b.git (cloned from /var/git/product_b.git)
> /home/alice/git/product_c.git (cloned from /var/git/product_c.git)
>
> Alice's links to her repos which she wants to be able to browse with gitweb :
>
> /home/alice/gitweb/product_a -> /home/alice/git/product_a.git/.git
> /home/alice/gitweb/product_c -> /home/alice/git/product_c.git/.git
>
> Bare repos :
>
> /var/git/product_a.git
> /var/git/product_b.git
> /var/git/product_c.git
> /var/git/product_d.git
>
> /etc/gitweb.conf :
>
> $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/git/";
>
> Apache configuration :
>
> RewriteRule ^/~([^\/]+)/?$ /cgi-bin/gitweb.cgi
> [QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]
>
> So now all users with a gitweb folder in their home will be able to
> browse all git repos in it through http://<host>/~<user>.
>
> You will find a patch enclosed which try to describe best what I did
> and why in the gitweb/README.

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-15 21:03 ` Junio C Hamano
@ 2009-11-17 13:58   ` Jakub Narebski
  2009-11-17 15:51     ` Sylvain Rabot
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Narebski @ 2009-11-17 13:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, Luben Tuikov, J.H., git, Sylvain Rabot

On Sun, 15 Nov 2009, Junio C Hamano wrote:
> Sylvain Rabot <sylvain@abstraction.fr> writes:
> 
> > I made gitweb behave a bit like UserDir module will in apache.
> > In fact it's only configuration but I think it could be useful to others.
> 
> Thanks.  Any comment from gitweb gangs?

I would respond earlier if it was submitted with patch inline in mail
body, and not attached.  If it needs to be attached (because of MUA/MTA
linewrapping or encoding issues), it should use 8bit and not base64
content transfer encoding, have 'text/plain' and not 
'application/octet-stream' content type, and "inline" and not "attachement"
in content disposition.

It also lacks proper commit message (although email describes it quite
well) and signoff, as per Documentation/SubmittingPatches.

I like this patch.  More examples in gitweb/README are always good idea.

> > Basicly it allows users of your server who use git to be able to use

"Basically"

> > gitweb to browse their own root project. E.G. :

"For example"

> >
> > Alice's private repos :
> >
> > /home/alice/git/product_a.git (cloned from /var/git/product_a.git)
> > /home/alice/git/product_b.git (cloned from /var/git/product_b.git)
> > /home/alice/git/product_c.git (cloned from /var/git/product_c.git)
> >
> > Alice's links to her repos which she wants to be able to browse with gitweb :

"Alice links", or "Alice creates symbolic links"

> >
> > /home/alice/gitweb/product_a -> /home/alice/git/product_a.git/.git
> > /home/alice/gitweb/product_c -> /home/alice/git/product_c.git/.git
> >
> > Bare repos :
> >
> > /var/git/product_a.git
> > /var/git/product_b.git
> > /var/git/product_c.git
> > /var/git/product_d.git

The description is a bit lacking.  Where user should put theirs git
repositories, or symbolic links to git repositories?  How it would
look like in gitweb?

-- 
Jakub Narebski
Poland

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 13:58   ` Jakub Narebski
@ 2009-11-17 15:51     ` Sylvain Rabot
  2009-11-17 18:12       ` Jakub Narebski
  0 siblings, 1 reply; 18+ messages in thread
From: Sylvain Rabot @ 2009-11-17 15:51 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Junio C Hamano, Petr Baudis, Luben Tuikov, J.H., git

On Tue, Nov 17, 2009 at 14:58, Jakub Narebski <jnareb@gmail.com> wrote:
> On Sun, 15 Nov 2009, Junio C Hamano wrote:
>> Sylvain Rabot <sylvain@abstraction.fr> writes:
>>
>> > I made gitweb behave a bit like UserDir module will in apache.
>> > In fact it's only configuration but I think it could be useful to others.
>>
>> Thanks.  Any comment from gitweb gangs?
>
> I would respond earlier if it was submitted with patch inline in mail
> body, and not attached.  If it needs to be attached (because of MUA/MTA
> linewrapping or encoding issues), it should use 8bit and not base64
> content transfer encoding, have 'text/plain' and not
> 'application/octet-stream' content type, and "inline" and not "attachement"
> in content disposition.

Sorry about that but I'm new in the git world and it is the first time
I submit a patch.

> It also lacks proper commit message (although email describes it quite
> well) and signoff, as per Documentation/SubmittingPatches.
>
> I like this patch.  More examples in gitweb/README are always good idea.
>
>> > Basicly it allows users of your server who use git to be able to use
>
> "Basically"

Oops

>
>> > gitweb to browse their own root project. E.G. :
>
> "For example"
>
>> >
>> > Alice's private repos :
>> >
>> > /home/alice/git/product_a.git (cloned from /var/git/product_a.git)
>> > /home/alice/git/product_b.git (cloned from /var/git/product_b.git)
>> > /home/alice/git/product_c.git (cloned from /var/git/product_c.git)
>> >
>> > Alice's links to her repos which she wants to be able to browse with gitweb :
>
> "Alice links", or "Alice creates symbolic links"
>
>> >
>> > /home/alice/gitweb/product_a -> /home/alice/git/product_a.git/.git
>> > /home/alice/gitweb/product_c -> /home/alice/git/product_c.git/.git
>> >
>> > Bare repos :
>> >
>> > /var/git/product_a.git
>> > /var/git/product_b.git
>> > /var/git/product_c.git
>> > /var/git/product_d.git
>
> The description is a bit lacking.  Where user should put theirs git
> repositories, or symbolic links to git repositories?

As I said It's only configuration so It depends of your server
architecture. If admin of the server decides he allows users to browse
via gitweb their private/public repos which are linked in
/home/*/.gitweb or anything else he has to modify the environmental
variable in the rewrite rule according to his wish.

> How it would look like in gitweb?

What do you mean ?

> --
> Jakub Narebski
> Poland

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 15:51     ` Sylvain Rabot
@ 2009-11-17 18:12       ` Jakub Narebski
  2009-11-17 19:56         ` Sylvain Rabot
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Narebski @ 2009-11-17 18:12 UTC (permalink / raw)
  To: Sylvain Rabot; +Cc: Junio C Hamano, Petr Baudis, Luben Tuikov, J.H., git

On Tue, 17 Nov 2009, Sylvain Rabot wrote:
> On Tue, Nov 17, 2009 at 14:58, Jakub Narebski <jnareb@gmail.com> wrote:

> > The description is a bit lacking.  Where user should put theirs git
> > repositories, or symbolic links to git repositories?
> 
> As I said It's only configuration so It depends of your server
> architecture. If admin of the server decides he allows users to browse
> via gitweb their private/public repos which are linked in
> /home/*/.gitweb or anything else he has to modify the environmental
> variable in the rewrite rule according to his wish.

So in described configuration, to make repository visible user would have
to put repository, or symbolic link to repository (or .git/ directory of
the repository) in ~/gitweb/ directory (just like one would need to put
HTML files in ~/public_html/ or ~/WWW/ to have them visible as web site),
isn't it?

> > How it would look like in gitweb?
> 
> What do you mean ?

How would example gitweb URL to repository look like?

-- 
Jakub Narebski
Poland

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 18:12       ` Jakub Narebski
@ 2009-11-17 19:56         ` Sylvain Rabot
  0 siblings, 0 replies; 18+ messages in thread
From: Sylvain Rabot @ 2009-11-17 19:56 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Junio C Hamano, Petr Baudis, Luben Tuikov, J.H., git

On Tue, Nov 17, 2009 at 19:12, Jakub Narebski <jnareb@gmail.com> wrote:
> On Tue, 17 Nov 2009, Sylvain Rabot wrote:
>> On Tue, Nov 17, 2009 at 14:58, Jakub Narebski <jnareb@gmail.com> wrote:
>
>> > The description is a bit lacking.  Where user should put theirs git
>> > repositories, or symbolic links to git repositories?
>>
>> As I said It's only configuration so It depends of your server
>> architecture. If admin of the server decides he allows users to browse
>> via gitweb their private/public repos which are linked in
>> /home/*/.gitweb or anything else he has to modify the environmental
>> variable in the rewrite rule according to his wish.
>
> So in described configuration, to make repository visible user would have
> to put repository, or symbolic link to repository (or .git/ directory of
> the repository) in ~/gitweb/ directory (just like one would need to put
> HTML files in ~/public_html/ or ~/WWW/ to have them visible as web site),
> isn't it?
>

That's right.

>> > How it would look like in gitweb?
>>
>> What do you mean ?
>
> How would example gitweb URL to repository look like?

http://repo.or.cz/ -> list the main GITWEB_PROJECTROOT (e.g.: /pub/scm)
http://repo.or.cz/~user -> list /home/user/gitweb
http://repo.or.cz/~user2 -> list /home/user2/gitweb
...

>
> --
> Jakub Narebski
> Poland
>

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-15 10:04 Make Gitweb behave like Apache mod_userdir Sylvain Rabot
  2009-11-15 21:03 ` Junio C Hamano
@ 2009-11-17 20:15 ` Junio C Hamano
  2009-11-17 20:24   ` Sylvain Rabot
  1 sibling, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2009-11-17 20:15 UTC (permalink / raw)
  To: Sylvain Rabot; +Cc: git, Jakub Narebski

Sylvain Rabot <sylvain@abstraction.fr> writes:

> +If you want gitweb to act a bit like UserDir mod in apache, knowing, http://<host>/~<user> 
> +will list all git repos of <user> located in a special directory in his home (/home/<user>/gitweb/), 
> +do the following steps :
> +
> +Add this to the VirtualHost section of your apache configuration file :
> +
> +   RewriteRule ^/~([^\/]+)/?$  /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]
> +
> +Modify your gitweb.conf file, located at /etc/gitweb.conf in this example, with :
> +
> +   $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/path/to/the/defaul/project/root"; 
> +
> +Thus, each user with a gitweb folder in his home will be able to browse it with gitweb.
> +/!\ The gitweb folder and user's home folder must be readable by the webserver user.

Wouldn't it be a good idea to somehow make this work well together with
the --user-path feature of git-daemon?

Perhaps the recommended name given in the example shouldn't be ~/gitweb,
but more like ~/public_git, as this is like ~/public_html but for git
repositories.  Then the end users will browse

	http://my.site/~gitster/public_git/git.git

and gitweb can be told to show

	clone URL: git://my.site/~gitster/public_git/git.git

on the page.  If the site administrator runs git-daemon with --user-path
set to public_git, everything will work seamlessly, no?

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 20:15 ` Junio C Hamano
@ 2009-11-17 20:24   ` Sylvain Rabot
  2009-11-17 22:10     ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Sylvain Rabot @ 2009-11-17 20:24 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jakub Narebski

On Tue, Nov 17, 2009 at 21:15, Junio C Hamano <gitster@pobox.com> wrote:
> Sylvain Rabot <sylvain@abstraction.fr> writes:
>
>> +If you want gitweb to act a bit like UserDir mod in apache, knowing, http://<host>/~<user>
>> +will list all git repos of <user> located in a special directory in his home (/home/<user>/gitweb/),
>> +do the following steps :
>> +
>> +Add this to the VirtualHost section of your apache configuration file :
>> +
>> +   RewriteRule ^/~([^\/]+)/?$  /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]
>> +
>> +Modify your gitweb.conf file, located at /etc/gitweb.conf in this example, with :
>> +
>> +   $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/path/to/the/defaul/project/root";
>> +
>> +Thus, each user with a gitweb folder in his home will be able to browse it with gitweb.
>> +/!\ The gitweb folder and user's home folder must be readable by the webserver user.
>
> Wouldn't it be a good idea to somehow make this work well together with
> the --user-path feature of git-daemon?
>
> Perhaps the recommended name given in the example shouldn't be ~/gitweb,
> but more like ~/public_git, as this is like ~/public_html but for git
> repositories.  Then the end users will browse

As I said, it's configuration :)

>
>        http://my.site/~gitster/public_git/git.git
>

would be http://my.site/~gitster/git.git

> and gitweb can be told to show
>
>        clone URL: git://my.site/~gitster/public_git/git.git

and git://my.site/~gitster/git.git

if --user-path of git daemon set to public_git

> on the page.  If the site administrator runs git-daemon with --user-path
> set to public_git, everything will work seamlessly, no?
>

Yes :)

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 20:24   ` Sylvain Rabot
@ 2009-11-17 22:10     ` Junio C Hamano
  2009-11-17 22:54       ` Sylvain Rabot
  2009-11-17 22:59       ` J.H.
  0 siblings, 2 replies; 18+ messages in thread
From: Junio C Hamano @ 2009-11-17 22:10 UTC (permalink / raw)
  To: Sylvain Rabot; +Cc: git, Jakub Narebski

Sylvain Rabot <sylvain@abstraction.fr> writes:

>> Wouldn't it be a good idea to somehow make this work well together with
>> the --user-path feature of git-daemon?
>>
>> Perhaps the recommended name given in the example shouldn't be ~/gitweb,
>> but more like ~/public_git, as this is like ~/public_html but for git
>> repositories.  Then the end users will browse
>
> As I said, it's configuration :)

Wrong answer.

Exactly because it is configurable, the document that outlines the
recommended practice should suggest the best convention.  My point was
that it is likely to be tied to "git"-ness of the specified directory
under $HOME/, not limited to "gitweb"-ness, and it is wrong to recommend a
name tied to "gitweb"-ness in this document.

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 22:10     ` Junio C Hamano
@ 2009-11-17 22:54       ` Sylvain Rabot
  2009-11-17 23:40         ` Junio C Hamano
  2009-11-17 22:59       ` J.H.
  1 sibling, 1 reply; 18+ messages in thread
From: Sylvain Rabot @ 2009-11-17 22:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jakub Narebski

On Tue, Nov 17, 2009 at 23:10, Junio C Hamano <gitster@pobox.com> wrote:
> Sylvain Rabot <sylvain@abstraction.fr> writes:
>
>>> Wouldn't it be a good idea to somehow make this work well together with
>>> the --user-path feature of git-daemon?
>>>
>>> Perhaps the recommended name given in the example shouldn't be ~/gitweb,
>>> but more like ~/public_git, as this is like ~/public_html but for git
>>> repositories.  Then the end users will browse
>>
>> As I said, it's configuration :)
>
> Wrong answer.
>

Am I passing a test ?

> Exactly because it is configurable, the document that outlines the
> recommended practice should suggest the best convention.  My point was
> that it is likely to be tied to "git"-ness of the specified directory
> under $HOME/, not limited to "gitweb"-ness, and it is wrong to recommend a
> name tied to "gitweb"-ness in this document.

Again, git is a brand new world for me and I don't know any of his
conventions yet.
I am not trying to impose my own conventions, I am just proposing an idea.
If you like it and want to make it more "git world compliant", please do so.

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 22:10     ` Junio C Hamano
  2009-11-17 22:54       ` Sylvain Rabot
@ 2009-11-17 22:59       ` J.H.
  2009-11-17 23:46         ` Junio C Hamano
  2009-11-18  0:16         ` Sylvain Rabot
  1 sibling, 2 replies; 18+ messages in thread
From: J.H. @ 2009-11-17 22:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sylvain Rabot, git, Jakub Narebski

Junio C Hamano wrote:
> Sylvain Rabot <sylvain@abstraction.fr> writes:
> 
>>> Wouldn't it be a good idea to somehow make this work well together with
>>> the --user-path feature of git-daemon?
>>>
>>> Perhaps the recommended name given in the example shouldn't be ~/gitweb,
>>> but more like ~/public_git, as this is like ~/public_html but for git
>>> repositories.  Then the end users will browse
>> As I said, it's configuration :)
> 
> Wrong answer.
> 
> Exactly because it is configurable, the document that outlines the
> recommended practice should suggest the best convention.  My point was
> that it is likely to be tied to "git"-ness of the specified directory
> under $HOME/, not limited to "gitweb"-ness, and it is wrong to recommend a
> name tied to "gitweb"-ness in this document.

For starters I think overriding the /~<user> (specifically the ~ here) 
is going to be a bad idea no matter what you do and gives the wrong 
impression about what / how the request is being responded to.  You 
might want to try and pick a different delimiter or re-work the rule so 
that you could have something like:

	http://git.kernel.org/<gitweb urls>
	http://git.kernel.org/user/<gitweb urls>

Your also, likely, going to need to take into account things like 
index.cgi and gitweb.cgi in the url as things like:

http://git.kernel.org/?p=bluetooth/bluez-gnome.git;a=summary
http://git.kernel.org/gitweb.cgi?p=bluetooth/bluez-gnome.git;a=summary

are likely to be correct for almost all installations.

I would agree with Junio on this, if your suggesting a possible practice 
you should focus on the best convention.  Making it depend on something 
like ~/gitweb doesn't make it clear or obvious enough to a user, or an 
administrator, that the directory is being exported for the world to 
see.  There is a reason it's called ~/public_html.

Keep in mind most people are going to read the documentation and 
copy/paste what they need and not change anything.



- John 'Warthog9' Hawley

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 22:54       ` Sylvain Rabot
@ 2009-11-17 23:40         ` Junio C Hamano
  2009-11-17 23:52           ` J.H.
  0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2009-11-17 23:40 UTC (permalink / raw)
  To: Sylvain Rabot; +Cc: J.H., git, Jakub Narebski

Sylvain Rabot <sylvain@abstraction.fr> writes:

> On Tue, Nov 17, 2009 at 23:10, Junio C Hamano <gitster@pobox.com> wrote:
>> Sylvain Rabot <sylvain@abstraction.fr> writes:
>>
>>>> Wouldn't it be a good idea to somehow make this work well together with
>>>> the --user-path feature of git-daemon?
>>>>
>>>> Perhaps the recommended name given in the example shouldn't be ~/gitweb,
>>>> but more like ~/public_git, as this is like ~/public_html but for git
>>>> repositories.  Then the end users will browse
>>>
>>> As I said, it's configuration :)
>>
>> Wrong answer.
>
> Am I passing a test ?

Sorry, but that wasn't what I meant.

>> Exactly because it is configurable, the document that outlines the
>> recommended practice should suggest the best convention.  My point was
>> that it is likely to be tied to "git"-ness of the specified directory
>> under $HOME/, not limited to "gitweb"-ness, and it is wrong to recommend a
>> name tied to "gitweb"-ness in this document.
>
> Again, git is a brand new world for me and I don't know any of his
> conventions yet.

I do not see this as git-specific conventions.

But suggesting ~/gitweb is perfectly excusable, especially if you did not
know that git-daemon can respond to "git://host/~user/".

John warthog19 (hmm, I thought he used to be warthog9) explained the above
much better than I did.  People tend to cut and paste without thinking, so
we should describe a good default layout in our documentation.

> I am not trying to impose my own conventions, I am just proposing an idea.

Yeah, I know.  We are all in this to improve things for people who follow
us.

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 22:59       ` J.H.
@ 2009-11-17 23:46         ` Junio C Hamano
  2009-11-17 23:59           ` J.H.
  2009-11-18  0:00           ` J.H.
  2009-11-18  0:16         ` Sylvain Rabot
  1 sibling, 2 replies; 18+ messages in thread
From: Junio C Hamano @ 2009-11-17 23:46 UTC (permalink / raw)
  To: J.H.; +Cc: Junio C Hamano, Sylvain Rabot, git, Jakub Narebski

"J.H." <warthog19@eaglescrag.net> writes:

> For starters I think overriding the /~<user> (specifically the ~ here)
> is going to be a bad idea no matter what you do and gives the wrong
> impression about what / how the request is being responded to.  You
> might want to try and pick a different delimiter or re-work the rule
> so that you could have something like:
>
> 	http://git.kernel.org/<gitweb urls>
> 	http://git.kernel.org/user/<gitweb urls>

I am not objecting but showing my ignorance, but why is it a bad idea to
allow

	http://git.kernel.org/~junio/git.git

to map to /home/junio/pubilic_git/git.git when

	http://www.kernel.org/~junio/index.html

maps to /home/junio/public_html/index.html already?

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 23:40         ` Junio C Hamano
@ 2009-11-17 23:52           ` J.H.
  0 siblings, 0 replies; 18+ messages in thread
From: J.H. @ 2009-11-17 23:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sylvain Rabot, git, Jakub Narebski

Junio C Hamano wrote:
> Sylvain Rabot <sylvain@abstraction.fr> writes:
> 
>> On Tue, Nov 17, 2009 at 23:10, Junio C Hamano <gitster@pobox.com> wrote:
>>> Sylvain Rabot <sylvain@abstraction.fr> writes:
>>>
>>>>> Wouldn't it be a good idea to somehow make this work well together with
>>>>> the --user-path feature of git-daemon?
>>>>>
>>>>> Perhaps the recommended name given in the example shouldn't be ~/gitweb,
>>>>> but more like ~/public_git, as this is like ~/public_html but for git
>>>>> repositories.  Then the end users will browse
>>>> As I said, it's configuration :)
>>> Wrong answer.
>> Am I passing a test ?
> 
> Sorry, but that wasn't what I meant.
> 
>>> Exactly because it is configurable, the document that outlines the
>>> recommended practice should suggest the best convention.  My point was
>>> that it is likely to be tied to "git"-ness of the specified directory
>>> under $HOME/, not limited to "gitweb"-ness, and it is wrong to recommend a
>>> name tied to "gitweb"-ness in this document.
>> Again, git is a brand new world for me and I don't know any of his
>> conventions yet.
> 
> I do not see this as git-specific conventions.
> 
> But suggesting ~/gitweb is perfectly excusable, especially if you did not
> know that git-daemon can respond to "git://host/~user/".
> 
> John warthog19 (hmm, I thought he used to be warthog9)

Yes I'm warthog9 (there's legacy reasons for warthog19 in the e-mail but 
- yeah)

> explained the above
> much better than I did.  People tend to cut and paste without thinking, so
> we should describe a good default layout in our documentation.
> 
>> I am not trying to impose my own conventions, I am just proposing an idea.
> 
> Yeah, I know.  We are all in this to improve things for people who follow
> us.

The biggest problem with the convention is not so much to impose our 
ideas on people, but that people have a tendency to, like I said, 
cut/paste the first thing they come across and never change it.

This isn't a bash on implementers by any stretch of the imagination, 
it's just that most people are not going to be well versed in 
git/gitweb, aren't going to understand some of the subtleties  and 
aren't going to want to actually read the complexities in documentation. 
  So by recommending good, generic, defaults means that people will, by 
default, get a better result.

- John 'Warthog9' Hawley

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 23:46         ` Junio C Hamano
@ 2009-11-17 23:59           ` J.H.
  2009-11-18  0:14             ` Junio C Hamano
  2009-11-18  0:00           ` J.H.
  1 sibling, 1 reply; 18+ messages in thread
From: J.H. @ 2009-11-17 23:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sylvain Rabot, git, Jakub Narebski

Junio C Hamano wrote:
> "J.H." <warthog19@eaglescrag.net> writes:
> 
>> For starters I think overriding the /~<user> (specifically the ~ here)
>> is going to be a bad idea no matter what you do and gives the wrong
>> impression about what / how the request is being responded to.  You
>> might want to try and pick a different delimiter or re-work the rule
>> so that you could have something like:
>>
>> 	http://git.kernel.org/<gitweb urls>
>> 	http://git.kernel.org/user/<gitweb urls>
> 
> I am not objecting but showing my ignorance, but why is it a bad idea to
> allow
> 
> 	http://git.kernel.org/~junio/git.git
> 
> to map to /home/junio/pubilic_git/git.git when
> 
> 	http://www.kernel.org/~junio/index.html
> 
> maps to /home/junio/public_html/index.html already?

I'm not objecting to the mapping, I'm objecting to the use of the ~ 
specifically, since that's the default for mod_userdir - it's more or 
less a race condition waiting to happen with respect to does mod_rewrite 
get to and process it first or does mod_userdir.

Case in point should:

assuming that www.example.com (to get away from the specifics of 
kernel.org) is running gitweb but you also wanted to allow users to show 
their ~/public_html directories then

	http://www.example.org/~junio/

could be ambiguous as to what should / is servicing the url.

Now in reality it should work because of how apache is setup, but I 
would argue it's a bad practice to overload the '~' designator like that 
for use in gitweb specifically.

If you have mod_userdir disabled / not available this isn't an issue, 
but making that assumption might be a bad idea.

- John 'Warthog9' Hawley

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 23:46         ` Junio C Hamano
  2009-11-17 23:59           ` J.H.
@ 2009-11-18  0:00           ` J.H.
  1 sibling, 0 replies; 18+ messages in thread
From: J.H. @ 2009-11-18  0:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sylvain Rabot, git, Jakub Narebski

Junio C Hamano wrote:
> "J.H." <warthog19@eaglescrag.net> writes:
> 
>> For starters I think overriding the /~<user> (specifically the ~ here)
>> is going to be a bad idea no matter what you do and gives the wrong
>> impression about what / how the request is being responded to.  You
>> might want to try and pick a different delimiter or re-work the rule
>> so that you could have something like:
>>
>> 	http://git.kernel.org/<gitweb urls>
>> 	http://git.kernel.org/user/<gitweb urls>
> 
> I am not objecting but showing my ignorance, but why is it a bad idea to
> allow
> 
> 	http://git.kernel.org/~junio/git.git
> 
> to map to /home/junio/pubilic_git/git.git when
> 
> 	http://www.kernel.org/~junio/index.html
> 
> maps to /home/junio/public_html/index.html already?

I'm not objecting to the mapping, I'm objecting to the use of the ~ 
specifically, since that's the default for mod_userdir - it's more or 
less a race condition waiting to happen with respect to does mod_rewrite 
get to and process it first or does mod_userdir.

Case in point should:

assuming that www.example.com (to get away from the specifics of 
kernel.org) is running gitweb but you also wanted to allow users to show 
their ~/public_html directories then

	http://www.example.org/~junio/

could be ambiguous as to what should / is servicing the url.

Now in reality it should work because of how apache is setup, but I 
would argue it's a bad practice to overload the '~' designator like that 
for use in gitweb specifically.

If you have mod_userdir disabled / not available this isn't an issue, 
but making that assumption might be a bad idea.

- John 'Warthog9' Hawley

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 23:59           ` J.H.
@ 2009-11-18  0:14             ` Junio C Hamano
  0 siblings, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2009-11-18  0:14 UTC (permalink / raw)
  To: J.H.; +Cc: Junio C Hamano, Sylvain Rabot, git, Jakub Narebski

"J.H." <warthog19@eaglescrag.net> writes:

> Junio C Hamano wrote:
>
>> I am not objecting but showing my ignorance, but why is it a bad idea to
>> allow
>>
>> 	http://git.kernel.org/~junio/git.git
>>
>> to map to /home/junio/pubilic_git/git.git when
>>
>> 	http://www.kernel.org/~junio/index.html
>>
>> maps to /home/junio/public_html/index.html already?
>
> I'm not objecting to the mapping, I'm objecting to the use of the ~
> specifically, since that's the default for mod_userdir - it's more or
> less a race condition waiting to happen with respect to does
> mod_rewrite get to and process it first or does mod_userdir.

Yeah, thanks for explaining it to me.  I realized the overlap between them
immediately after I sent the message out X-<.

	http://site.xz/users/gitster/git.git

(or anything that does not override "~name") sounds good to me.

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

* Re: Make Gitweb behave like Apache mod_userdir
  2009-11-17 22:59       ` J.H.
  2009-11-17 23:46         ` Junio C Hamano
@ 2009-11-18  0:16         ` Sylvain Rabot
  1 sibling, 0 replies; 18+ messages in thread
From: Sylvain Rabot @ 2009-11-18  0:16 UTC (permalink / raw)
  To: J.H.; +Cc: Junio C Hamano, git, Jakub Narebski

> For starters I think overriding the /~<user> (specifically the ~ here) is
> going to be a bad idea no matter what you do and gives the wrong impression
> about what / how the request is being responded to.  You might want to try
> and pick a different delimiter or re-work the rule so that you could have
> something like:
>
>        http://git.kernel.org/<gitweb urls>
>        http://git.kernel.org/user/<gitweb urls>
>
> Your also, likely, going to need to take into account things like index.cgi
> and gitweb.cgi in the url as things like:
>
> http://git.kernel.org/?p=bluetooth/bluez-gnome.git;a=summary
> http://git.kernel.org/gitweb.cgi?p=bluetooth/bluez-gnome.git;a=summary
>

<VirtualHost git.abstraction.fr:80>

        ServerAdmin webmaster@abstraction.fr
        ServerName git.abstraction.fr:80
        DocumentRoot /var/www/sylvain/git.abstraction.fr/html

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug

        CustomLog /var/www/sylvain/git.abstraction.fr/log/access.log combined
        ErrorLog /var/www/sylvain/git.abstraction.fr/log/error.log
        ServerSignature On

        RewriteEngine on
        RewriteLog /var/www/sylvain/git.abstraction.fr/log/rewrite.log
        RewriteLogLevel 3
        RewriteRule ^/$
/cgi-bin/gitweb.cgi     [QSA,L,PT]
        RewriteRule ^/gitweb.cgi$
/cgi-bin/gitweb.cgi     [QSA,L,PT]
        RewriteRule ^/\~([^\/]+)/?$
/cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
        RewriteRule ^/\~([^\/]+)/gitweb.cgi$
/cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
        RewriteRule ^/users/([^\/]+)/?$
/cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
        RewriteRule ^/users/([^\/]+)/gitweb.cgi$
/cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin/">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        Alias /gitweb /usr/share/gitweb/
        <Directory "/usr/share/gitweb/">
                AllowOverride None
                Options +MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

</VirtualHost>


You can test here :

http://git.abstraction.fr/
http://git.abstraction.fr/gitweb.cgi
http://git.abstraction.fr/~sylvain/
http://git.abstraction.fr/~sylvain/gitweb.cgi
http://git.abstraction.fr/users/sylvain/
http://git.abstraction.fr/users/sylvain/gitweb.cgi

The dns record is fresh. If your dns is not up to date the ip is 88.191.254.60.

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

end of thread, other threads:[~2009-11-18  0:55 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-15 10:04 Make Gitweb behave like Apache mod_userdir Sylvain Rabot
2009-11-15 21:03 ` Junio C Hamano
2009-11-17 13:58   ` Jakub Narebski
2009-11-17 15:51     ` Sylvain Rabot
2009-11-17 18:12       ` Jakub Narebski
2009-11-17 19:56         ` Sylvain Rabot
2009-11-17 20:15 ` Junio C Hamano
2009-11-17 20:24   ` Sylvain Rabot
2009-11-17 22:10     ` Junio C Hamano
2009-11-17 22:54       ` Sylvain Rabot
2009-11-17 23:40         ` Junio C Hamano
2009-11-17 23:52           ` J.H.
2009-11-17 22:59       ` J.H.
2009-11-17 23:46         ` Junio C Hamano
2009-11-17 23:59           ` J.H.
2009-11-18  0:14             ` Junio C Hamano
2009-11-18  0:00           ` J.H.
2009-11-18  0:16         ` Sylvain Rabot

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