summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff/parallel_diff.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-06-20 19:15:44 +0200
committerDouwe Maan <douwe@selenight.nl>2016-07-06 18:50:59 -0400
commita27462a5c6da0182f6b3a55c9417e6405f2c0415 (patch)
tree6bdf936568c0f9274cbf24db7f8b6517b2200980 /lib/gitlab/diff/parallel_diff.rb
parent375193455aa5cb752f1035a6cc69160170a58477 (diff)
downloadgitlab-ce-a27462a5c6da0182f6b3a55c9417e6405f2c0415.tar.gz
Extract parts of LegacyDiffNote into DiffOnNote concern and move part of responsibility to other classes
Diffstat (limited to 'lib/gitlab/diff/parallel_diff.rb')
-rw-r--r--lib/gitlab/diff/parallel_diff.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/gitlab/diff/parallel_diff.rb b/lib/gitlab/diff/parallel_diff.rb
index 74f9b3c050a..2d15b64fdb0 100644
--- a/lib/gitlab/diff/parallel_diff.rb
+++ b/lib/gitlab/diff/parallel_diff.rb
@@ -15,7 +15,7 @@ module Gitlab
highlighted_diff_lines.each do |line|
full_line = line.text
type = line.type
- line_code = generate_line_code(diff_file.file_path, line)
+ line_code = diff_file.line_code(line)
line_new = line.new_pos
line_old = line.old_pos
@@ -23,9 +23,9 @@ module Gitlab
if next_line
next_line = highlighted_diff_lines[next_line.index]
- next_line_code = generate_line_code(diff_file.file_path, next_line)
+ full_next_line = next_line.text
+ next_line_code = diff_file.line_code(next_line)
next_type = next_line.type
- next_line = next_line.text
end
case type
@@ -59,8 +59,8 @@ module Gitlab
right: {
type: next_type,
number: line_new,
- text: next_line,
- line_code: next_line_code
+ text: full_next_line,
+ line_code: next_line_code,
}
}
skip_next = true
@@ -108,12 +108,6 @@ module Gitlab
end
lines
end
-
- private
-
- def generate_line_code(file_path, line)
- Gitlab::Diff::LineCode.generate(file_path, line.new_pos, line.old_pos)
- end
end
end
end