diff options
author | David Turner <novalis@novalis.org> | 2017-04-18 01:44:32 -0400 |
---|---|---|
committer | David Turner <novalis@novalis.org> | 2017-05-15 16:04:46 -0400 |
commit | 897a85a461b95ece12a1c5daaa86f55c27ddadcb (patch) | |
tree | 9f855cc73be0e1f171b18078c5a3eccab7140c5f /app/helpers | |
parent | ea5d43a3b8c01fb83d215a7eb15f246f26a34c64 (diff) | |
download | gitlab-ce-897a85a461b95ece12a1c5daaa86f55c27ddadcb.tar.gz |
submodule_links: Handle in-repository submodule urls
Sometimes it is useful to store submodules in the same repository which
contains links to them. Make the UI support this.
See
https://github.com/twosigma/git-meta/wiki/The-Omega-Repo
for information about this strategy
Signed-off-by: David Turner <novalis@novalis.org>
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/submodule_helper.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index b739554a7a4..09b73eee8cf 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -7,6 +7,10 @@ module SubmoduleHelper def submodule_links(submodule_item, ref = nil, repository = @repository) url = repository.submodule_url_for(ref, submodule_item.path) + if url == '.' || url == './' + url = File.join(Gitlab.config.gitlab.url, @project.full_path) + end + if url =~ /([^\/:]+)\/([^\/]+(?:\.git)?)\Z/ namespace, project = $1, $2 project.sub!(/\.git\z/, '') |