diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-05-15 13:19:49 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-05-23 15:37:05 -0500 |
commit | 7c479d88a92233790bc0fb63146fe004f8b9b5d7 (patch) | |
tree | 3691c9e55229b145ea631bca724ba4da8c467d70 /app/helpers | |
parent | 7e09a9b7dcef125af2e775869754a3327935b12d (diff) | |
download | gitlab-ce-7c479d88a92233790bc0fb63146fe004f8b9b5d7.tar.gz |
Pass fallback_diff_refs to Diff::File instead of using view helpers
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/diff_helper.rb | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 4cfaa103741..4c4fbdd4d39 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -102,30 +102,14 @@ module DiffHelper ].join(' ').html_safe end - def diff_content_commit(diff_file) - content_commit = diff_file.content_commit - return content_commit if content_commit - - if diff_file.deleted_file? - diff_old_content_commit(diff_file) - else - @commit - end - end - - def diff_old_content_commit(diff_file) - return if diff_file.new_file? - - diff_file.old_content_commit || @base_commit || @commit.parent || @commit - end - def diff_file_blob_raw_path(diff_file) - namespace_project_raw_path(@project.namespace, @project, tree_join(diff_content_commit(diff_file).sha, diff_file.file_path)) + namespace_project_raw_path(@project.namespace, @project, tree_join(diff_file.content_sha, diff_file.file_path)) end def diff_file_old_blob_raw_path(diff_file) - return if diff_file.new_file? - namespace_project_raw_path(@project.namespace, @project, tree_join(diff_old_content_commit(diff_file).sha, diff_file.old_path)) + sha = diff_file.old_content_sha + return unless sha + namespace_project_raw_path(@project.namespace, @project, tree_join(diff_file.old_content_sha, diff_file.old_path)) end def diff_file_html_data(project, diff_file_path, diff_commit_id) |