diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-06-05 17:39:36 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-06-05 17:39:36 +0000 |
commit | 5872273841ad7080fb2c8addaeb67712d1b8bf37 (patch) | |
tree | eab566f77d0818c5381ae2060d8baa05e67e4cc6 /app/helpers | |
parent | 6be3f910bad180909fbb14f000376a8334292d37 (diff) | |
parent | 9c2ca7aab6a8cdbdb30cdca8a8b58ad843addb9f (diff) | |
download | gitlab-ce-5872273841ad7080fb2c8addaeb67712d1b8bf37.tar.gz |
Merge branch 'dz-fix-submodule-subgroup' into 'master'
Fix submodule link to then project under subgroup
Closes gitlab-ee#2411
See merge request !11906
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/submodule_helper.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index c0763a8a9c4..8e0a1e2ecdf 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -13,6 +13,17 @@ module SubmoduleHelper if url =~ /([^\/:]+)\/([^\/]+(?:\.git)?)\Z/ namespace, project = $1, $2 + gitlab_hosts = [Gitlab.config.gitlab.url, + Gitlab.config.gitlab_shell.ssh_path_prefix] + + gitlab_hosts.each do |host| + if url.start_with?(host) + namespace, _, project = url.sub(host, '').rpartition('/') + break + end + end + + namespace.sub!(/\A\//, '') project.rstrip! project.sub!(/\.git\z/, '') |