diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-18 00:06:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-18 00:06:41 +0300 |
commit | da35510cdad8f8d3cb6c119682dc2735531983cd (patch) | |
tree | d42432c9ddc0d55a3c6316cdb539af11244a148f /app/models | |
parent | 7f82744e89f22bdd2d13f85ca4dc66e088f3da5c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/application_setting_implementation.rb | 3 | ||||
-rw-r--r-- | app/models/project.rb | 17 | ||||
-rw-r--r-- | app/models/project_wiki.rb | 2 |
3 files changed, 17 insertions, 5 deletions
diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb index b341cf04403..0c0ffb67c9a 100644 --- a/app/models/application_setting_implementation.rb +++ b/app/models/application_setting_implementation.rb @@ -128,7 +128,8 @@ module ApplicationSettingImplementation snowplow_collector_hostname: nil, snowplow_cookie_domain: nil, snowplow_enabled: false, - snowplow_site_id: nil + snowplow_site_id: nil, + custom_http_clone_url_root: nil } end diff --git a/app/models/project.rb b/app/models/project.rb index f1e232e95f8..3525f37f8d5 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1036,8 +1036,8 @@ class Project < ApplicationRecord end end - def web_url - Gitlab::Routing.url_helpers.project_url(self) + def web_url(only_path: nil) + Gitlab::Routing.url_helpers.project_url(self, only_path: only_path) end def readme_url @@ -1316,7 +1316,18 @@ class Project < ApplicationRecord end def http_url_to_repo - "#{web_url}.git" + custom_root = Gitlab::CurrentSettings.custom_http_clone_url_root + + project_url = if custom_root.present? + Gitlab::Utils.append_path( + custom_root, + web_url(only_path: true) + ) + else + web_url + end + + "#{project_url}.git" end # Is overridden in EE diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 218be974218..bb222ac7629 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -54,7 +54,7 @@ class ProjectWiki end def http_url_to_repo - "#{Gitlab.config.gitlab.url}/#{full_path}.git" + @project.http_url_to_repo.sub(%r{git\z}, 'wiki.git') end def wiki_base_path |