Commit db77a612 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add config option to disable git-annex

parent 487b1bf2
......@@ -46,3 +46,8 @@ log_level: INFO
# Set to true to see real usernames in the logs instead of key ids, which is easier to follow, but
# incurs an extra API call on every gitlab-shell command.
audit_usernames: false
# Enable git-annex support
# git-annex allows managing files with git, without checking the file contents into git
# See https://git-annex.branchable.com/ for documentation
git_annex_enabled: true
......@@ -47,6 +47,10 @@ class GitlabConfig
@config['audit_usernames'] ||= false
end
def git_annex_enabled?
@config['git_annex_enabled'] ||= true
end
# Build redis command to write update event in gitlab queue
def redis_command
if redis.empty?
......
......@@ -50,11 +50,11 @@ class GitlabShell
args = Shellwords.shellwords(@origin_cmd)
@git_cmd = args.first
if @git_cmd == 'git-annex-shell'
if @git_cmd == 'git-annex-shell' && @config.git_annex_enabled?
@repo_name = escape_path(args[2].gsub("\/~\/", ''))
# Make sure repository has git-annex enabled
enable_git_annex(@repo_name)
init_git_annex(@repo_name)
else
raise DisallowedCommandError unless args.count == 2
@repo_name = escape_path(args.last)
......@@ -68,7 +68,7 @@ class GitlabShell
def process_cmd
repo_full_path = File.join(repos_path, repo_name)
if @git_cmd == 'git-annex-shell'
if @git_cmd == 'git-annex-shell' && @config.git_annex_enabled?
args = Shellwords.shellwords(@origin_cmd)
parsed_args =
args.map do |arg|
......@@ -127,7 +127,7 @@ class GitlabShell
end
end
def enable_git_annex(path)
def init_git_annex(path)
full_repo_path = File.join(repos_path, path)
unless File.exists?(File.join(full_repo_path, '.git', 'annex'))
......
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