diff options
author | James Lopez <james@jameslopez.es> | 2018-07-31 16:02:29 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-08-01 07:51:05 +0200 |
commit | 66e00351605afd524c1ac8df7fcd0690bd074747 (patch) | |
tree | e4e67ff81c5962ada99e2f09bf2e48596b2ff795 | |
parent | 72888f59a57084a7dab49b3b67bc8622db34777f (diff) | |
download | gitlab-shell-66e00351605afd524c1ac8df7fcd0690bd074747.tar.gz |
use GIT_PROTOCOL env variable in gitlab_shell#exec
-rw-r--r-- | lib/gitlab_shell.rb | 2 | ||||
-rw-r--r-- | spec/gitlab_shell_spec.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index 39dabe9..78fdfe8 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -118,7 +118,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength self.repo_path = status.repository_path @gl_repository = status.gl_repository - @git_protocol = status.git_protocol + @git_protocol = ENV['GIT_PROTOCOL'] @gitaly = status.gitaly @username = status.gl_username if defined?(@who) diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index f2c215e..382cad4 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -162,6 +162,10 @@ describe GitlabShell do ) end + before do + allow(ENV).to receive(:[]).with('GIT_PROTOCOL').and_return(git_protocol) + end + shared_examples_for 'upload-pack' do |command| let(:ssh_cmd) { "#{command} gitlab-ci.git" } after { subject.exec(ssh_cmd) } @@ -462,7 +466,7 @@ describe GitlabShell do 'GL_ID' => gl_id, 'GL_PROTOCOL' => 'ssh', 'GL_REPOSITORY' => gl_repository, - 'GL_USERNAME' => 'testuser', + 'GL_USERNAME' => 'testuser' } end let(:exec_options) { { unsetenv_others: true, chdir: ROOT_PATH } } |