git-serve.py: Automatically create repositories

Create a fresh Git repository when cloning or pushing using a path that
does not yet exist.

Implements FS#43308.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2015-01-06 23:28:57 +01:00
parent e8c48e9f4c
commit 02dd9c518f

View file

@ -119,6 +119,8 @@ if action == 'git-upload-pack' or action == 'git-receive-pack':
if not repo_path_validate(path): if not repo_path_validate(path):
die('%s: invalid path: %s' % (action, path)) die('%s: invalid path: %s' % (action, path))
pkgbase = repo_path_get_pkgbase(path) pkgbase = repo_path_get_pkgbase(path)
if not os.path.exists(path):
setup_repo(pkgbase, user)
if action == 'git-receive-pack': if action == 'git-receive-pack':
if not check_permissions(pkgbase, user): if not check_permissions(pkgbase, user):
die('%s: permission denied: %s' % (action, user)) die('%s: permission denied: %s' % (action, user))