summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-06-12 16:56:04 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-06-12 16:58:00 +0200
commit3158e038c8565232c2f3aec4a736a4a047935d56 (patch)
tree4c7fa0f0ca98e3e6a6d68cac431d7214a8074679
parenta32b83f200123047e88bede033e49893cf01b20c (diff)
downloadaurweb-3158e038c8565232c2f3aec4a736a4a047935d56.tar.xz
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 <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rwxr-xr-xgit-interface/git-serve.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-interface/git-serve.py b/git-interface/git-serve.py
index a6dee13..26aa02d 100755
--- a/git-interface/git-serve.py
+++ b/git-interface/git-serve.py
@@ -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))