diff options
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r-- | app/helpers/diff_helper.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index afe7447d4e2..8332b86d485 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -49,14 +49,16 @@ module DiffHelper next_line = diff_file.next_line(line.index) if next_line + next_line_code = generate_line_code(diff_file.file_path, next_line) next_type = next_line.type next_line = next_line.text end - line = [type, line_old, full_line, line_code, next_type, line_new] + line = [type, line_old, full_line, line_code, next_line_code, next_type, line_new] + if type == 'match' || type.nil? # line in the right panel is the same as in the left one - line = [type, line_old, full_line, line_code, type, line_new, full_line] + line = [type, line_old, full_line, line_code, line_code, type, line_new, full_line] lines.push(line) elsif type == 'old' if next_type == 'new' @@ -78,7 +80,7 @@ module DiffHelper next else # Change is only on the right side, left side has no change - line = [nil, nil, " ", line_code, type, line_new, full_line] + line = [nil, nil, " ", line_code, line_code, type, line_new, full_line] lines.push(line) end end @@ -97,4 +99,8 @@ module DiffHelper line end end + + def line_comments + @line_comments ||= @line_notes.group_by(&:line_code) + end end |