Commit c062e56b4cc8d0397bb709e4f5e3aa251b63aa90

Authored by Dmitriy Zaporozhets
1 parent ae416a76

Fixed commit diff: content of removed files displayed

app/helpers/commits_helper.rb
@@ -53,11 +53,13 @@ module CommitsHelper @@ -53,11 +53,13 @@ module CommitsHelper
53 53
54 lines_arr = diff_arr 54 lines_arr = diff_arr
55 lines_arr.each do |line| 55 lines_arr.each do |line|
  56 + next if line.match(/^\-\-\- \/dev\/null/)
  57 + next if line.match(/^\+\+\+ \/dev\/null/)
  58 + next if line.match(/^\-\-\- a/)
  59 + next if line.match(/^\+\+\+ b/)
  60 +
56 full_line = html_escape(line.gsub(/\n/, '')) 61 full_line = html_escape(line.gsub(/\n/, ''))
57 62
58 - next if line.match(/^--- \/dev\/null/)  
59 - next if line.match(/^--- a/)  
60 - next if line.match(/^\+\+\+ b/)  
61 if line.match(/^@@ -/) 63 if line.match(/^@@ -/)
62 next if line_old == 1 && line_new == 1 64 next if line_old == 1 && line_new == 1
63 type = "match" 65 type = "match"
app/views/commits/_diffs.html.haml
@@ -4,11 +4,12 @@ @@ -4,11 +4,12 @@
4 - diffs.each_with_index do |diff, i| 4 - diffs.each_with_index do |diff, i|
5 - next if diff.diff.empty? 5 - next if diff.diff.empty?
6 - file = (@commit.tree / diff.b_path) 6 - file = (@commit.tree / diff.b_path)
  7 + - file = (@commit.prev_commit.tree / diff.a_path) unless file
7 - next unless file 8 - next unless file
8 .diff_file 9 .diff_file
9 .diff_file_header 10 .diff_file_header
10 - if diff.deleted_file 11 - if diff.deleted_file
11 - %strong{:id => "#{diff.b_path}"}= diff.a_path 12 + %strong{:id => "#{diff.a_path}"}= diff.a_path
12 - else 13 - else
13 = link_to tree_file_project_ref_path(@project, @commit.id, diff.b_path) do 14 = link_to tree_file_project_ref_path(@project, @commit.id, diff.b_path) do
14 %strong{:id => "#{diff.b_path}"}= diff.b_path 15 %strong{:id => "#{diff.b_path}"}= diff.b_path