Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 00:09:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 00:09:21 +0300
commit87af6f2e0590af0ed1bb3e5de1bb5d21855a94d2 (patch)
tree2abe2661b10cf6281bc03855b3053a072c64fbbf /app/helpers
parentc43ba2677f41ad0b5fc6f3af6baf4266c70dfcb3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/submodule_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb
index 1149b168383..e9554300075 100644
--- a/app/helpers/submodule_helper.rb
+++ b/app/helpers/submodule_helper.rb
@@ -38,6 +38,8 @@ module SubmoduleHelper
url_helpers.namespace_project_tree_path(namespace, project, submodule_item_id)]
elsif relative_self_url?(url)
relative_self_links(url, submodule_item_id, repository.project)
+ elsif gist_github_dot_com_url?(url)
+ gist_github_com_tree_links(namespace, project, submodule_item_id)
elsif github_dot_com_url?(url)
github_com_tree_links(namespace, project, submodule_item_id)
elsif gitlab_dot_com_url?(url)
@@ -52,6 +54,10 @@ module SubmoduleHelper
protected
+ def gist_github_dot_com_url?(url)
+ url =~ %r{gist\.github\.com[/:][^/]+/[^/]+\Z}
+ end
+
def github_dot_com_url?(url)
url =~ %r{github\.com[/:][^/]+/[^/]+\Z}
end
@@ -78,6 +84,11 @@ module SubmoduleHelper
[base, [base, '/-/tree/', commit].join('')]
end
+ def gist_github_com_tree_links(namespace, project, commit)
+ base = ['https://gist.github.com/', namespace, '/', project].join('')
+ [base, [base, commit].join('/')]
+ end
+
def github_com_tree_links(namespace, project, commit)
base = ['https://github.com/', namespace, '/', project].join('')
[base, [base, '/tree/', commit].join('')]