Commit 42ba6d04f84b722bc1212378633cd8c05a2c6ded
1 parent
c2cfc52e
Exists in
master
and in
4 other branches
refactor each_line detect to detect all diff file
Showing
2 changed files
with
5 additions
and
3 deletions
Show diff stats
app/views/commits/_text_file.html.haml
1 | 1 | %table |
2 | 2 | - line_old = 0 |
3 | 3 | - line_new = 0 |
4 | - - lines_arr = diff.diff.lines.to_a | |
4 | + - diff_str = encode(diff.diff) | |
5 | + - lines_arr = diff_str.lines.to_a | |
5 | 6 | - lines_arr.each do |line| |
6 | - - line = encode(line) | |
7 | 7 | - next if line.match(/^--- \/dev\/null/) |
8 | 8 | - next if line.match(/^--- a/) |
9 | 9 | - next if line.match(/^\+\+\+ b/) |
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | = link_to raw(diff_line_class(line) == "new" ? " " : line_old), "#OLD#{index}-#{line_old}", :id => "OLD#{index}-#{line_old}" |
19 | 19 | %td.new_line |
20 | 20 | = link_to raw(diff_line_class(line) == "old" ? " " : line_new) , "#NEW#{index}-#{line_new}", :id => "NEW#{index}-#{line_new}" |
21 | - %td.line_content{:class => diff_line_class(full_line)}= raw "#{full_line} " | |
21 | + %td.line_content{:class => diff_line_class(full_line)}= raw "#{full_line} " | |
22 | 22 | - if line[0] == "+" |
23 | 23 | - line_new += 1 |
24 | 24 | - elsif line[0] == "-" | ... | ... |