git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Gitweb: Scan dir for repos & show these other specified repos
@ 2010-03-01 19:15 Mike.lifeguard
  2010-03-01 19:55 ` Jakub Narebski
  0 siblings, 1 reply; 8+ messages in thread
From: Mike.lifeguard @ 2010-03-01 19:15 UTC (permalink / raw)
  To: git

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

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

Thanks for the help.

- -Mike
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkuMEmQACgkQst0AR/DaKHuYiQCeL3EoeUCr676lbwE2PIZK2tk3
7dsAoMpBmKoZZj3LV1zKLVqtIpFIiIii
=YDlg
-----END PGP SIGNATURE-----

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

* Re: Gitweb: Scan dir for repos & show these other specified repos
  2010-03-01 19:15 Gitweb: Scan dir for repos & show these other specified repos Mike.lifeguard
@ 2010-03-01 19:55 ` Jakub Narebski
  2010-03-01 21:20   ` Sylvain Rabot
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Narebski @ 2010-03-01 19:55 UTC (permalink / raw)
  To: Mike.lifeguard; +Cc: git

"Mike.lifeguard" <mike.lifeguard@gmail.com> 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.

P.P.S. Alternate solution would be to try to work around it with
automount / autofs or something like that.
-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Re: Gitweb: Scan dir for repos & show these other specified repos
  2010-03-01 19:55 ` Jakub Narebski
@ 2010-03-01 21:20   ` Sylvain Rabot
  2010-03-01 22:18     ` Jakub Narebski
  0 siblings, 1 reply; 8+ messages in thread
From: Sylvain Rabot @ 2010-03-01 21:20 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Mike.lifeguard, git

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

On Mon, 2010-03-01 at 11:55 -0800, Jakub Narebski wrote:
> "Mike.lifeguard" <mike.lifeguard@gmail.com> 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 <sylvain@abstraction.fr>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: Gitweb: Scan dir for repos & show these other specified repos
  2010-03-01 21:20   ` Sylvain Rabot
@ 2010-03-01 22:18     ` Jakub Narebski
  2010-03-01 22:22       ` Sylvain Rabot
  2010-03-02  0:04       ` [PATCH] gitweb multiple project roots documentation Sylvain Rabot
  0 siblings, 2 replies; 8+ messages in thread
From: Jakub Narebski @ 2010-03-01 22:18 UTC (permalink / raw)
  To: Sylvain Rabot; +Cc: Mike.lifeguard, git

On Mon, 1 Mar 2010, Sylvain Rabot wrote:
> On Mon, 2010-03-01 at 11:55 -0800, Jakub Narebski wrote:
> > "Mike.lifeguard" <mike.lifeguard@gmail.com> 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...

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

Would you mind writing it up and adding it as an example in gitweb/README?
If you don't have time, I can try to do this myself in my free time.

-- 
Jakub Narebski
Poland

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

* Re: Gitweb: Scan dir for repos & show these other specified repos
  2010-03-01 22:18     ` Jakub Narebski
@ 2010-03-01 22:22       ` Sylvain Rabot
  2010-03-02  0:04       ` [PATCH] gitweb multiple project roots documentation Sylvain Rabot
  1 sibling, 0 replies; 8+ messages in thread
From: Sylvain Rabot @ 2010-03-01 22:22 UTC (permalink / raw)
  To: git

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

On Mon, 2010-03-01 at 23:18 +0100, Jakub Narebski wrote:
> On Mon, 1 Mar 2010, Sylvain Rabot wrote:
> > On Mon, 2010-03-01 at 11:55 -0800, Jakub Narebski wrote:
> > > "Mike.lifeguard" <mike.lifeguard@gmail.com> 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...
> 
> > > 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.
> 
> Would you mind writing it up and adding it as an example in gitweb/README?
> If you don't have time, I can try to do this myself in my free time.

Not at all. I will try to make it the more understandable possible and I
will send you the patch.


-- 
Sylvain Rabot <sylvain@abstraction.fr>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* [PATCH] gitweb multiple project roots documentation
  2010-03-01 22:18     ` Jakub Narebski
  2010-03-01 22:22       ` Sylvain Rabot
@ 2010-03-02  0:04       ` Sylvain Rabot
  2010-03-02  0:38         ` Jakub Narebski
  2010-03-10 18:55         ` [PATCH] gitweb readme fixed regarding per user project root repository Sylvain Rabot
  1 sibling, 2 replies; 8+ messages in thread
From: Sylvain Rabot @ 2010-03-02  0:04 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Sylvain Rabot

This commit adds in the gitweb/README file a description of how to use gitweb
with several project roots using apache virtualhost rewrite rules.

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
---
 gitweb/README |   67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/gitweb/README b/gitweb/README
index 6c2c8e1..2e55d38 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -312,12 +312,16 @@ If you want to have one URL for both gitweb and your http://
 repositories, you can configure apache like this:
 
 <VirtualHost *:80>
-    ServerName git.example.org
-    DocumentRoot /pub/git
-    SetEnv	GITWEB_CONFIG	/etc/gitweb.conf
+    ServerName		git.example.org
+    DocumentRoot	/pub/git
+    SetEnv			GITWEB_CONFIG	/etc/gitweb.conf
+
+    # turning on mod rewrite
     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>
@@ -343,6 +347,63 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file:
   $home_link = "/";
 
 
+Webserver configuration with multiple projects' root
+----------------------------------------------------
+
+If you want to use gitweb with several project roots you can edit your apache
+virtual host and gitweb.conf configuration files like this :
+
+virtual host configuration :
+
+<VirtualHost *:80>
+    ServerName			git.example.org
+    DocumentRoot		/pub/git
+    SetEnv				GITWEB_CONFIG	/etc/gitweb.conf
+
+    # turning on mod rewrite
+    RewriteEngine on
+
+    # make the front page an internal rewrite to the gitweb script
+    RewriteRule ^/$ 		/cgi-bin/gitweb.cgi [QSA,L,PT]
+
+    # look for a public_git folder in unix users' home
+    # http://git.example.org/~<user>/
+    RewriteRule ^/\~([^\/]+)(/|/gitweb.cgi)?$	/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
+
+    # http://git.example.org/+<user>/
+    #RewriteRule ^/\+([^\/]+)(/|/gitweb.cgi)?$	/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
+
+    # http://git.example.org/user/<user>/
+    #RewriteRule ^/user/([^\/]+)/(gitweb.cgi)?$	/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
+
+    # defined list of project roots
+    RewriteRule ^/scm(/|/gitweb.cgi)?$		/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/pub/scm/,L,PT]
+    RewriteRule ^/var(/|/gitweb.cgi)?$		/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/var/git/,L,PT]
+
+    # make access for "dumb clients" work
+    RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI}  [L,PT]
+</VirtualHost>
+
+gitweb.conf configuration :
+
+$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/pub/git";
+
+These configurations enable two things. First, each unix user (<user>) of the
+server will be able to browse through gitweb git repositories found in
+~/public_git/ with the following url : http://git.example.org/~<user>/
+
+If you do not want this feature on your server just remove the second rewrite rule.
+
+If you already use mod_userdir in your virtual host or you don't want to use 
+the '~' as first character just comment or remove the second rewrite rule and 
+uncomment one of the following according to what you want.
+
+Second, repositories found in /pub/scm/ and /var/git/ will be accesible
+through http://git.example.org/scm/ and http://git.example.org/var/.
+You can add as many project roots as you want by adding rewrite rules like the
+third and the fourth.
+
+
 PATH_INFO usage
 -----------------------
 If you enable PATH_INFO usage in gitweb by putting
-- 
1.7.0

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

* Re: [PATCH] gitweb multiple project roots documentation
  2010-03-02  0:04       ` [PATCH] gitweb multiple project roots documentation Sylvain Rabot
@ 2010-03-02  0:38         ` Jakub Narebski
  2010-03-10 18:55         ` [PATCH] gitweb readme fixed regarding per user project root repository Sylvain Rabot
  1 sibling, 0 replies; 8+ messages in thread
From: Jakub Narebski @ 2010-03-02  0:38 UTC (permalink / raw)
  To: Sylvain Rabot; +Cc: git

Sylvain Rabot wrote:

> This commit adds in the gitweb/README file a description of how to use gitweb
> with several project roots using apache virtualhost rewrite rules.
> 
> Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>

For what it is worth:

Acked-by: Jakub Narebski <jnareb@gmail.com>

-- 
Jakub Narebski
Poland

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

* [PATCH] gitweb readme fixed regarding per user project root repository
  2010-03-02  0:04       ` [PATCH] gitweb multiple project roots documentation Sylvain Rabot
  2010-03-02  0:38         ` Jakub Narebski
@ 2010-03-10 18:55         ` Sylvain Rabot
  1 sibling, 0 replies; 8+ messages in thread
From: Sylvain Rabot @ 2010-03-10 18:55 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Junio C Hamano, Sylvain Rabot

the RewriteRule involving the '+' character is not working as it is
replaced by a space in urls when you click on links.

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
---
 gitweb/README |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gitweb/README b/gitweb/README
index ad6a04c..2acf595 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -347,18 +347,18 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file:
   $home_link = "/";
 
 
-Webserver configuration with multiple projects' root
+Webserver configuration with multiple projects roots
 ----------------------------------------------------
 
-If you want to use gitweb with several project roots you can edit your apache
-virtual host and gitweb.conf configuration files like this :
+If you want to use gitweb with several projects roots then you can edit your
+apache virtual host and gitweb.conf configuration files like this :
 
 virtual host configuration :
 
 <VirtualHost *:80>
     ServerName			git.example.org
     DocumentRoot		/pub/git
-    SetEnv				GITWEB_CONFIG	/etc/gitweb.conf
+    SetEnv			GITWEB_CONFIG	/etc/gitweb.conf
 
     # turning on mod rewrite
     RewriteEngine on
@@ -370,8 +370,8 @@ virtual host configuration :
     # http://git.example.org/~<user>/
     RewriteRule ^/\~([^\/]+)(/|/gitweb.cgi)?$	/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
 
-    # http://git.example.org/+<user>/
-    #RewriteRule ^/\+([^\/]+)(/|/gitweb.cgi)?$	/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
+    # http://git.example.org/u/<user>/
+    #RewriteRule ^/u/([^\/]+)(/|/gitweb.cgi)?$	/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
 
     # http://git.example.org/user/<user>/
     #RewriteRule ^/user/([^\/]+)/(gitweb.cgi)?$	/cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
-- 
1.7.0

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

end of thread, other threads:[~2010-03-10 18:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-01 19:15 Gitweb: Scan dir for repos & show these other specified repos Mike.lifeguard
2010-03-01 19:55 ` Jakub Narebski
2010-03-01 21:20   ` Sylvain Rabot
2010-03-01 22:18     ` Jakub Narebski
2010-03-01 22:22       ` Sylvain Rabot
2010-03-02  0:04       ` [PATCH] gitweb multiple project roots documentation Sylvain Rabot
2010-03-02  0:38         ` Jakub Narebski
2010-03-10 18:55         ` [PATCH] gitweb readme fixed regarding per user project root repository 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).