diff --git a/app/helpers/commit_helper.rb b/app/helpers/commit_helper.rb index fa3353a0a..9fbde2526 100644 --- a/app/helpers/commit_helper.rb +++ b/app/helpers/commit_helper.rb @@ -89,7 +89,8 @@ module CommitHelper def file_blob_in_diff(repo, commit_id, diff) tree = repo.tree(commit_id) - diff.renamed_file ? (tree / diff.b_path) : (tree / (diff.a_path.presence || diff.b_path)) + blob = diff.renamed_file ? (tree / diff.b_path) : (tree / (diff.a_path.presence || diff.b_path)) + blob || diff.a_blob || diff.b_blob end def get_commit_id_for_file(diff, commit, parent_commit) diff --git a/app/views/projects/git/commits/_diff.html.slim b/app/views/projects/git/commits/_diff.html.slim index 471e95e77..32720b1e7 100644 --- a/app/views/projects/git/commits/_diff.html.slim +++ b/app/views/projects/git/commits/_diff.html.slim @@ -32,6 +32,4 @@ == render 'file_removed_not_changed', blob: blob - elsif !blob.binary? - - if (@project.repo.tree(commit_id) / diff.b_path).nil? - = "a_path=#{diff.a_path}; b_path=#{diff.b_path}" == render_diff(diff, diff_counter: diff_counter, comments: @comments)