chiark / gitweb /
git-daemon: no need for a special configuration variable namespace
[userv-utils.git] / git-daemon / git-daemon-urlmap.pl
index 5f587be08647bf1a034f94eb9f645dcfb152330d..61c376cbe9328f4dfc340acb63e825ffa4350202 100644 (file)
@@ -1,20 +1,27 @@
-# Configuration file for the userv git daemon.
+# Example configuration file for the userv git daemon.
 #
 # This was written by Tony Finch <dot@dotat.at>
 # You may do anything with it, at your own risk.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
-use warnings;
-use strict;
-
-my $g = qr{[0-9a-z_-]+[.]git};
-my $u = qr{[0-9a-z]+};
-
-return "~fanf/public-git/$1", "fanf"      if m{^git://dotat[.]at/($g)$};
-return "/u2/git-repos$1",     "webmaster" if m{^git://git[.]chiark[.]greenend[.]org[.]uk/($g)$};
-return "~$1/public-git/$2",   "$1"        if m{^git://git[.]chiark[.]greenend[.]org[.]uk/~($u)/($g)$};
-return "~$1/cabal-git/$2",    "$1"               if m{^git://cabal[.]greenend[.]org[.]uk/~($u)/($g)$};
-
-return;
+if ($host eq 'git.chiark.greenend.org.uk') {
+    if ($path =~ m{^~([^/]*)/(.*)}) {
+        $user = $1;
+        $dir = 'public-git';
+        $repo = $2;
+    } else {
+        $user = 'webmaster';
+        $dir = '/u2/git-repos';
+        $repo = $path;
+    }
+} elsif (m{^git://cabal[.]greenend[.]org[.]uk/~([^/]*)/(.*)$}) {
+    $user = $1;
+    $dir = 'cabal-git';
+    $repo = $2;
+} elsif ($host eq 'dotat.at') {
+    $user = 'fanf';
+    $dir = 'public-git';
+    $repo = $path;
+}
 
 # end