Commit 3158e038 authored by Johannes Löthberg's avatar Johannes Löthberg Committed by Lukas Fleischer
Browse files

git-serve: Support cloning with simplified paths



This commit adds support for cloning repositories over SSH without a
leading slash or with a trailing .git

Fixes FS#45260
Signed-off-by: Johannes Löthberg's avatarJohannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent a32b83f2
......@@ -123,8 +123,10 @@ if action == 'git-upload-pack' or action == 'git-receive-pack':
die_with_help("%s: missing path" % (action))
path = cmdargv[1].rstrip('/')
if not path.startswith('/') or not path.endswith('.git'):
die('%s: invalid path: %s' % (action, path))
if not path.startswith('/'):
path = '/' + path
if not path.endswith('.git'):
path = path + '.git'
pkgbase = path[1:-4]
if not re.match(repo_regex, pkgbase):
die('%s: invalid repository name: %s' % (action, pkgbase))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment