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 53  
54 54 lines_arr = diff_arr
55 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 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 63 if line.match(/^@@ -/)
62 64 next if line_old == 1 && line_new == 1
63 65 type = "match"
... ...
app/views/commits/_diffs.html.haml
... ... @@ -4,11 +4,12 @@
4 4 - diffs.each_with_index do |diff, i|
5 5 - next if diff.diff.empty?
6 6 - file = (@commit.tree / diff.b_path)
  7 + - file = (@commit.prev_commit.tree / diff.a_path) unless file
7 8 - next unless file
8 9 .diff_file
9 10 .diff_file_header
10 11 - if diff.deleted_file
11   - %strong{:id => "#{diff.b_path}"}= diff.a_path
  12 + %strong{:id => "#{diff.a_path}"}= diff.a_path
12 13 - else
13 14 = link_to tree_file_project_ref_path(@project, @commit.id, diff.b_path) do
14 15 %strong{:id => "#{diff.b_path}"}= diff.b_path
... ...