diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-16 08:58:18 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-16 08:58:18 -0800 |
commit | db77a6120745364036512c31b93428cd0714b884 (patch) | |
tree | 5790bd7b1ee542641ae3a44dd7e902cf07298639 | |
parent | 487b1bf271907e04701fd8a750d194a5b06eb4c0 (diff) | |
download | gitlab-shell-db77a6120745364036512c31b93428cd0714b884.tar.gz |
Add config option to disable git-annex
-rw-r--r-- | config.yml.example | 5 | ||||
-rw-r--r-- | lib/gitlab_config.rb | 4 | ||||
-rw-r--r-- | lib/gitlab_shell.rb | 8 |
3 files changed, 13 insertions, 4 deletions
diff --git a/config.yml.example b/config.yml.example index 97b5006..66ab52d 100644 --- a/config.yml.example +++ b/config.yml.example @@ -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 diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb index c97743b..422898d 100644 --- a/lib/gitlab_config.rb +++ b/lib/gitlab_config.rb @@ -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? diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index 98a5cbc..ed25e07 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -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')) |