diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-08-11 17:50:38 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-08-11 17:53:15 +0200 |
commit | 979a6df4755a114e38cd1825be40cb07225f1fb4 (patch) | |
tree | 0edd8d60be470657db1a22ed2d4b90a67377caa6 | |
parent | c31e6165016e4f12483b4c328a62493adac1bcac (diff) | |
download | gitlab-shell-979a6df4755a114e38cd1825be40cb07225f1fb4.tar.gz |
Skip 'git annex init' when using 'gcryptsetup'no-init-on-gcryptsetup
'gcryptsetup' is a special git-annex feature that does its own
initialization.
-rw-r--r-- | lib/gitlab_shell.rb | 7 | ||||
-rw-r--r-- | spec/gitlab_shell_spec.rb | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index 57c319c..cbfe468 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -67,7 +67,7 @@ class GitlabShell @repo_name = escape_path(args[2].sub(/\A\/~\//, '')) # Make sure repository has git-annex enabled - init_git_annex(@repo_name) + init_git_annex(@repo_name) unless gcryptsetup?(args) when 'git-lfs-authenticate' raise DisallowedCommandError unless args.count >= 2 @repo_name = escape_path(args[1]) @@ -174,4 +174,9 @@ class GitlabShell $logger.info "Enable git-annex for repository: #{path}." end end + + def gcryptsetup?(args) + non_dashed = args.reject { |a| a.start_with?('-') } + non_dashed[0, 2] == %w{git-annex-shell gcryptsetup} + end end diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index 77523d7..62e0d36 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -96,6 +96,14 @@ describe GitlabShell do it 'should init git-annex' do File.exists?(File.join(tmp_repos_path, 'dzaporozhets/gitlab.git/annex')).should be_true end + + context 'with git-annex-shell gcryptsetup' do + let(:ssh_cmd) { 'git-annex-shell gcryptsetup /~/dzaporozhets/gitlab.git' } + + it 'should not init git-annex' do + File.exists?(File.join(tmp_repos_path, 'dzaporozhets/gitlab.git/annex')).should be_false + end + end end end |