diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-09-12 18:43:44 +0200 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-09-12 18:44:53 +0200 |
commit | 5564fe31491a8a584b66feb6097742ec4025b8fa (patch) | |
tree | 87cfd197e994c182b901453b7076250874447010 /app/helpers/diff_helper.rb | |
parent | 29f990002c6e2704bb25ba4aa89491f319699202 (diff) | |
download | gitlab-ce-5564fe31491a8a584b66feb6097742ec4025b8fa.tar.gz |
Add comments on the side-by-side diff.
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 |