Subject: Re: Gitweb: Scan dir for repos & show these other specified repos

From: Sylvain Rabot <[email-masked]>
Date: Mon, 01 Mar 2010 22:20:19 +0100

On Mon, 2010-03-01 at 11:55 -0800, Jakub Narebski wrote:
> "Mike.lifeguard" <[email-masked]> writes:
> 
> > Is it possible to have gitweb show all repositories in /path/to/wherever
> > and also show some other repositories at particular locations like
> > /home/user/git/repo1 and /home/user2/git/repo2 ? Or better yet, scan
> > multiple dirs? Currently I can only see how to do one or the other
> > within a single gitweb installation. I suppose I could run two of them...
> 
> It is not possible with $projects_list being directory (or undefined,
> which means to take $projectroot), but I think it is possible with
> $projects_list being a file.
> 
> You would have to set $projectroot to common prefix (it might be
> empty, i.e. '' if there is no common prefix), then list there all
> repositories, relative to $projectroot.  See gitweb/README and
> gitweb/INSTALL, and comments in gitweb.perl for details on file
> format.
> 
> 
> P.S. It probably be a good idea to have something like mod_userdir,
> but gitweb currently doesn't support something like that.

I had the same problematic some times ago. I wanted to have several
project's roots folder for gitweb (one for each unix user of the
server).

You can find the discussion here :

http://thread.gmane.org/gmane.comp.version-control.git/132926/
http://marc.info/?t=125827961600002&r=1&w=2

Here the configuration I used :

/etc/gitweb.conf :

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

/etc/apache2/sites-available/yourvirtualhost :

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

I.E. :

http://yourvirtualhost/ will have /var/gitweb as proeject root
http://yourvirtualhost/~<user>/ will have /home/<users>/gitweb as
proeject root

You can modify the rewrite rule to match what you want to do.

> 
> P.P.S. Alternate solution would be to try to work around it with
> automount / autofs or something like that.

-- 
Sylvain Rabot <[email-masked]>