From 3dd96139a1e4c20fe278561e7c537e02b8ffade2 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Sun, 2 Sep 2007 13:28:41 -0700 Subject: Make gitosis-serve create repositories on demand when pushing. --- gitosis/serve.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gitosis/serve.py') diff --git a/gitosis/serve.py b/gitosis/serve.py index 2b7e7da..82976c8 100644 --- a/gitosis/serve.py +++ b/gitosis/serve.py @@ -10,6 +10,7 @@ import sys, os, optparse, re from ConfigParser import RawConfigParser from gitosis import access +from gitosis import repository def die(msg): print >>sys.stderr, '%s: %s' % (sys.argv[0], msg) @@ -106,6 +107,13 @@ def serve( # didn't have write access and tried to write raise WriteAccessDenied() + if (not os.path.exists(newpath) + and verb in COMMANDS_WRITE): + # it doesn't exist on the filesystem, but the configuration + # refers to it, we're serving a write request, and the user is + # authorized to do that: create the repository on the fly + repository.init(path=newpath) + # put the verb back together with the new path newcmd = "%(verb)s '%(newpath)s'" % dict( verb=verb, -- cgit v1.2.3