From c7fa5ecce6a4b4766a956d46dea64f5a194ec4df Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Fri, 28 Dec 2007 03:46:05 -0800 Subject: Allow some slashes, to provide support for git+ssh:// URLs that always have a leading slash. --- gitosis/test/test_serve.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'gitosis/test/test_serve.py') diff --git a/gitosis/test/test_serve.py b/gitosis/test/test_serve.py index f5785f5..deb9637 100644 --- a/gitosis/test/test_serve.py +++ b/gitosis/test/test_serve.py @@ -117,6 +117,39 @@ def test_simple_read(): ) eq(got, "git-upload-pack '%s/foo.git'" % tmp) +def test_simple_read_absolute(): + tmp = util.maketemp() + full_path = os.path.join(tmp, 'foo.git') + repository.init(full_path) + cfg = RawConfigParser() + cfg.add_section('gitosis') + cfg.set('gitosis', 'repositories', tmp) + cfg.add_section('group foo') + cfg.set('group foo', 'members', 'jdoe') + cfg.set('group foo', 'readonly', 'foo') + got = serve.serve( + cfg=cfg, + user='jdoe', + command="git-upload-pack '%s'" % (full_path, ), + ) + eq(got, "git-upload-pack '%s/foo.git'" % tmp) + +def test_simple_read_leading_slash(): + tmp = util.maketemp() + repository.init(os.path.join(tmp, 'foo.git')) + cfg = RawConfigParser() + cfg.add_section('gitosis') + cfg.set('gitosis', 'repositories', tmp) + cfg.add_section('group foo') + cfg.set('group foo', 'members', 'jdoe') + cfg.set('group foo', 'readonly', 'foo') + got = serve.serve( + cfg=cfg, + user='jdoe', + command="git-upload-pack '/foo'", + ) + eq(got, "git-upload-pack '%s/foo.git'" % tmp) + def test_simple_write(): tmp = util.maketemp() repository.init(os.path.join(tmp, 'foo.git')) -- cgit v1.2.3