summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-11-17 12:35:05 +0000
committerWinnie Hellmann <winnie@gitlab.com>2017-11-17 14:22:36 +0000
commit4dd9988470fdf2d7e122579602491327697c0f93 (patch)
tree409789258877bde6c736ea8b0fa3a634a1cb02a7
parent9f62c6791381be14000168d098ab867015db6c4b (diff)
downloadgitlab-ce-4dd9988470fdf2d7e122579602491327697c0f93.tar.gz
Merge branch 'dm-go-get-blank-enabled-protocol' into 'master'
Fix go-import meta data when enabled_git_access_protocol is a blank string Closes #40256 See merge request gitlab-org/gitlab-ce!15448 (cherry picked from commit 69dd59aec9e5f8959fa36eb74db28d71aad4212b) f767dd4a Fix go-import meta data when enabled_git_access_protocol is a blank string
-rw-r--r--lib/gitlab/middleware/go.rb5
-rw-r--r--spec/lib/gitlab/middleware/go_spec.rb8
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/gitlab/middleware/go.rb b/lib/gitlab/middleware/go.rb
index cfc6b2a2029..1edda50e4b0 100644
--- a/lib/gitlab/middleware/go.rb
+++ b/lib/gitlab/middleware/go.rb
@@ -42,12 +42,11 @@ module Gitlab
project_url = URI.join(config.gitlab.url, path)
import_prefix = strip_url(project_url.to_s)
- repository_url = case current_application_settings.enabled_git_access_protocol
- when 'ssh'
+ repository_url = if current_application_settings.enabled_git_access_protocol == 'ssh'
shell = config.gitlab_shell
port = ":#{shell.ssh_port}" unless shell.ssh_port == 22
"ssh://#{shell.ssh_user}@#{shell.ssh_host}#{port}/#{path}.git"
- when 'http', nil
+ else
"#{project_url}.git"
end
diff --git a/spec/lib/gitlab/middleware/go_spec.rb b/spec/lib/gitlab/middleware/go_spec.rb
index 67121937398..60a134be939 100644
--- a/spec/lib/gitlab/middleware/go_spec.rb
+++ b/spec/lib/gitlab/middleware/go_spec.rb
@@ -127,6 +127,14 @@ describe Gitlab::Middleware::Go do
include_examples 'go-get=1', enabled_protocol: nil
end
+
+ context 'with nothing disabled (blank string)' do
+ before do
+ stub_application_setting(enabled_git_access_protocol: '')
+ end
+
+ include_examples 'go-get=1', enabled_protocol: nil
+ end
end
def go