Allow `gitosis-serve
incoming path names to always have
.git
` suffix.
Strip it before processing further.
This commit is contained in:
parent
7b99ae7583
commit
0dc22b3155
|
@ -23,6 +23,16 @@ def haveAccess(config, user, mode, path):
|
||||||
path=path,
|
path=path,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
basename, ext = os.path.splitext(path)
|
||||||
|
if ext == '.git':
|
||||||
|
log.debug(
|
||||||
|
'Stripping .git suffix from %(path)r, new value %(basename)r'
|
||||||
|
% dict(
|
||||||
|
path=path,
|
||||||
|
basename=basename,
|
||||||
|
))
|
||||||
|
path = basename
|
||||||
|
|
||||||
for groupname in group.getMembership(config=config, user=user):
|
for groupname in group.getMembership(config=config, user=user):
|
||||||
try:
|
try:
|
||||||
repos = config.get('group %s' % groupname, mode)
|
repos = config.get('group %s' % groupname, mode)
|
||||||
|
|
|
@ -120,3 +120,12 @@ def test_base_local():
|
||||||
eq(access.haveAccess(
|
eq(access.haveAccess(
|
||||||
config=cfg, user='jdoe', mode='writable', path='foo/bar'),
|
config=cfg, user='jdoe', mode='writable', path='foo/bar'),
|
||||||
'some/relative/path/baz/quux/thud')
|
'some/relative/path/baz/quux/thud')
|
||||||
|
|
||||||
|
def test_dotgit():
|
||||||
|
# a .git extension is always allowed to be added
|
||||||
|
cfg = RawConfigParser()
|
||||||
|
cfg.add_section('group fooers')
|
||||||
|
cfg.set('group fooers', 'members', 'jdoe')
|
||||||
|
cfg.set('group fooers', 'writable', 'foo/bar')
|
||||||
|
eq(access.haveAccess(config=cfg, user='jdoe', mode='writable', path='foo/bar.git'),
|
||||||
|
'foo/bar')
|
||||||
|
|
Loading…
Reference in a new issue