Commit 341c1a20 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Immediatly raise exception if git-annex is disabled

parent b37c4d67
......@@ -50,11 +50,15 @@ class GitlabShell
args = Shellwords.shellwords(@origin_cmd)
@git_cmd = args.first
if @git_cmd == 'git-annex-shell' && @config.git_annex_enabled?
if @git_cmd == 'git-annex-shell'
if @config.git_annex_enabled?
@repo_name = escape_path(args[2].sub(/\A\/~\//, ''))
# Make sure repository has git-annex enabled
init_git_annex(@repo_name)
else
raise DisallowedCommandError
end
else
raise DisallowedCommandError unless args.count == 2
@repo_name = escape_path(args.last)
......@@ -68,7 +72,8 @@ class GitlabShell
def process_cmd
repo_full_path = File.join(repos_path, repo_name)
if @git_cmd == 'git-annex-shell' && @config.git_annex_enabled?
if @git_cmd == 'git-annex-shell'
if @config.git_annex_enabled?
args = Shellwords.shellwords(@origin_cmd)
parsed_args =
args.map do |arg|
......@@ -83,6 +88,9 @@ class GitlabShell
$logger.info "gitlab-shell: executing git-annex command <#{parsed_args.join(' ')}> for #{log_username}."
exec_cmd(*parsed_args)
else
raise DisallowedCommandError
end
else
$logger.info "gitlab-shell: executing git command <#{@git_cmd} #{repo_full_path}> for #{log_username}."
exec_cmd(@git_cmd, repo_full_path)
......
Markdown is supported
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