diff options
author | Stan Hu <stanhu@gmail.com> | 2015-04-12 22:27:45 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-04-27 20:42:38 -0700 |
commit | 72a7febeada2c58c98caee8bb7ce18886a7c0868 (patch) | |
tree | 22cde467a3b87e93babb526b154003ffad12fef6 /app | |
parent | 9f443f42578f8f995415f3d0b9aa9ee8aebeff0b (diff) | |
download | gitlab-ce-72a7febeada2c58c98caee8bb7ce18886a7c0868.tar.gz |
Fix "Revspec not found" errors when viewing diffs in a forked project with submodules
Closes #1413
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/diff_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/submodule_helper.rb | 4 | ||||
-rw-r--r-- | app/views/projects/diffs/_file.html.haml | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 4f42972a4dd..162778ade58 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -140,8 +140,8 @@ module DiffHelper end end - def submodule_link(blob, ref) - tree, commit = submodule_links(blob, ref) + def submodule_link(blob, ref, repository = @repository) + tree, commit = submodule_links(blob, ref, repository) commit_id = if commit.nil? blob.id[0..10] else diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index e13d4eaf101..6def7793dc3 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -2,8 +2,8 @@ module SubmoduleHelper include Gitlab::ShellAdapter # links to files listing for submodule if submodule is a project on this server - def submodule_links(submodule_item, ref = nil) - url = @repository.submodule_url_for(ref, submodule_item.path) + 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/ diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml index 672a6635321..d4b019780f5 100644 --- a/app/views/projects/diffs/_file.html.haml +++ b/app/views/projects/diffs/_file.html.haml @@ -11,7 +11,7 @@ = view_file_btn(@commit.parent_id, diff_file, project) - elsif diff_file.diff.submodule? - submodule_item = project.repository.blob_at(@commit.id, diff_file.file_path) - = submodule_link(submodule_item, @commit.id) + = submodule_link(submodule_item, @commit.id, project.repository) - else %span - if diff_file.renamed_file |