summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-11-17 12:17:16 +0100
committerDouwe Maan <douwe@selenight.nl>2017-11-17 12:17:16 +0100
commitf767dd4a4da2086de699eb55f468a646846b4632 (patch)
tree6cb6d48839f58ace54bed007fe480bb415872a7a
parent4d55503217316ea9a8a4f1a5523814b5eb20ed49 (diff)
downloadgitlab-ce-f767dd4a4da2086de699eb55f468a646846b4632.tar.gz
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