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 ...@@ -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 # 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. # incurs an extra API call on every gitlab-shell command.
audit_usernames: false 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 ...@@ -47,6 +47,10 @@ class GitlabConfig
@config['audit_usernames'] ||= false @config['audit_usernames'] ||= false
end end
def git_annex_enabled?
@config['git_annex_enabled'] ||= true
end
# Build redis command to write update event in gitlab queue # Build redis command to write update event in gitlab queue
def redis_command def redis_command
if redis.empty? if redis.empty?
......
...@@ -50,11 +50,11 @@ class GitlabShell ...@@ -50,11 +50,11 @@ class GitlabShell
args = Shellwords.shellwords(@origin_cmd) args = Shellwords.shellwords(@origin_cmd)
@git_cmd = args.first @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("\/~\/", '')) @repo_name = escape_path(args[2].gsub("\/~\/", ''))
# Make sure repository has git-annex enabled # Make sure repository has git-annex enabled
enable_git_annex(@repo_name) init_git_annex(@repo_name)
else else
raise DisallowedCommandError unless args.count == 2 raise DisallowedCommandError unless args.count == 2
@repo_name = escape_path(args.last) @repo_name = escape_path(args.last)
...@@ -68,7 +68,7 @@ class GitlabShell ...@@ -68,7 +68,7 @@ class GitlabShell
def process_cmd def process_cmd
repo_full_path = File.join(repos_path, repo_name) 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) args = Shellwords.shellwords(@origin_cmd)
parsed_args = parsed_args =
args.map do |arg| args.map do |arg|
...@@ -127,7 +127,7 @@ class GitlabShell ...@@ -127,7 +127,7 @@ class GitlabShell
end end
end end
def enable_git_annex(path) def init_git_annex(path)
full_repo_path = File.join(repos_path, path) full_repo_path = File.join(repos_path, path)
unless File.exists?(File.join(full_repo_path, '.git', 'annex')) 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