Module: SubmoduleHelper

Includes:
Gitlab::ShellAdapter
Defined in:
app/helpers/submodule_helper.rb

Instance Method Summary collapse

Methods included from Gitlab::ShellAdapter

#gitlab_shell

Instance Method Details

links to files listing for submodule if submodule is a project on this server


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/submodule_helper.rb', line 5

def submodule_links(submodule_item, ref = nil, repository = @repository)
  url = repository.submodule_url_for(ref, submodule_item.path)

  return url, nil unless url =~ /([^\/:]+)\/([^\/]+\.git)\Z/

  namespace = $1
  project = $2
  project.chomp!('.git')

  if self_url?(url, namespace, project)
    return namespace_project_path(namespace, project),
      namespace_project_tree_path(namespace, project,
                                  submodule_item.id)
  elsif relative_self_url?(url)
    relative_self_links(url, submodule_item.id)
  elsif github_dot_com_url?(url)
    standard_links('github.com', namespace, project, submodule_item.id)
  elsif gitlab_dot_com_url?(url)
    standard_links('gitlab.com', namespace, project, submodule_item.id)
  else
    return url, nil
  end
end