Commit dee11dadad88ed83300c7684aab52e5508f29f24
1 parent
8b6a14b5
Exists in
spb-stable
and in
3 other branches
Fix submodules
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
8 additions
and
5 deletions
Show diff stats
app/helpers/submodule_helper.rb
| @@ -3,7 +3,10 @@ module SubmoduleHelper | @@ -3,7 +3,10 @@ module SubmoduleHelper | ||
| 3 | 3 | ||
| 4 | # links to files listing for submodule if submodule is a project on this server | 4 | # links to files listing for submodule if submodule is a project on this server |
| 5 | def submodule_links(submodule_item) | 5 | def submodule_links(submodule_item) |
| 6 | - url = submodule_item.submodule_url | 6 | + submodule = @repository.submodules(@ref)[submodule_item.path] |
| 7 | + | ||
| 8 | + url = submodule['url'] if submodule | ||
| 9 | + | ||
| 7 | return url, nil unless url =~ /([^\/:]+\/[^\/]+\.git)\Z/ | 10 | return url, nil unless url =~ /([^\/:]+\/[^\/]+\.git)\Z/ |
| 8 | 11 | ||
| 9 | project = $1 | 12 | project = $1 |
| @@ -19,7 +22,7 @@ module SubmoduleHelper | @@ -19,7 +22,7 @@ module SubmoduleHelper | ||
| 19 | return url, nil | 22 | return url, nil |
| 20 | end | 23 | end |
| 21 | end | 24 | end |
| 22 | - | 25 | + |
| 23 | protected | 26 | protected |
| 24 | 27 | ||
| 25 | def github_dot_com_url?(url) | 28 | def github_dot_com_url?(url) |
| @@ -29,14 +32,14 @@ module SubmoduleHelper | @@ -29,14 +32,14 @@ module SubmoduleHelper | ||
| 29 | def gitlab_dot_com_url?(url) | 32 | def gitlab_dot_com_url?(url) |
| 30 | url =~ /gitlab\.com[\/:][^\/]+\/[^\/]+\Z/ | 33 | url =~ /gitlab\.com[\/:][^\/]+\/[^\/]+\Z/ |
| 31 | end | 34 | end |
| 32 | - | 35 | + |
| 33 | def self_url?(url, project) | 36 | def self_url?(url, project) |
| 34 | return true if url == [ Gitlab.config.gitlab.url, '/', project, '.git' ].join('') | 37 | return true if url == [ Gitlab.config.gitlab.url, '/', project, '.git' ].join('') |
| 35 | url == gitlab_shell.url_to_repo(project) | 38 | url == gitlab_shell.url_to_repo(project) |
| 36 | end | 39 | end |
| 37 | - | 40 | + |
| 38 | def standard_links(host, project, commit) | 41 | def standard_links(host, project, commit) |
| 39 | base = [ 'https://', host, '/', project ].join('') | 42 | base = [ 'https://', host, '/', project ].join('') |
| 40 | return base, [ base, '/tree/', commit ].join('') | 43 | return base, [ base, '/tree/', commit ].join('') |
| 41 | end | 44 | end |
| 42 | -end | ||
| 43 | \ No newline at end of file | 45 | \ No newline at end of file |
| 46 | +end |