diff options
Diffstat (limited to 'gitcmd')
-rwxr-xr-x | gitcmd | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -5,6 +5,9 @@ import os def printerr(*l, **d): return print(*l, **d, file=sys.stderr) def fail(*l, **d): printerr(*l, **d); raise SystemExit(1) +def lsexit_repositories(repositories_ro, repositories_rw): + print('\n'.join(repositories_ro + repositories_rw or ['Empty list'])) + raise SystemExit(0) try: user = sys.argv[1] @@ -29,8 +32,7 @@ try: repository = ssh_original_command[1].split('.git')[0].strip("'") except IndexError: if command == 'ls': - print('\n'.join(repositories_ro + repositories_rw or ['Empty list'])) - raise SystemExit(0) + lsexit_repositories(repositories_ro, repositories_rw) fail('Invalid repository name or git usage') except KeyError: fail('Bad boy, git only access authorized.') @@ -43,5 +45,7 @@ if command == 'git-upload-pack' and repository in repositories_ro: elif command == 'git-receive-pack' and repository in repositories_rw: os.execv('/usr/bin/git-receive-pack', ['/usr/bin/git-receive-pack', repository]) +elif command == 'ls': + lsexit_repositories(repositories_ro, []) else: fail('Bad git command or inexistant repository or access denied') |