Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r--app/helpers/diff_helper.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index 8332b86d485..c2ce6ed0fe4 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -36,7 +36,10 @@ module DiffHelper
# Building array of lines
#
- # [left_type, left_line_number, left_line_content, line_code, right_line_type, right_line_number, right_line_content]
+ # [
+ # left_type, left_line_number, left_line_content, left_line_code,
+ # right_line_type, right_line_number, right_line_content, right_line_code
+ # ]
#
diff_file.diff_lines.each do |line|
@@ -54,23 +57,20 @@ module DiffHelper
next_line = next_line.text
end
- 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, line_code, type, line_new, full_line]
+ line = [type, line_old, full_line, line_code, type, line_new, full_line, line_code]
lines.push(line)
elsif type == 'old'
if next_type == 'new'
# Left side has text removed, right side has text added
- line.push(next_line)
+ line = [type, line_old, full_line, line_code, next_type, line_new, next_line, next_line_code]
lines.push(line)
skip_next = true
elsif next_type == 'old' || next_type.nil?
# Left side has text removed, right side doesn't have any change
- line.pop # remove the newline
- line.push(nil) # no line number on the right panel
- line.push(" ") # empty line on the right panel
+ # No next line code, no new line number, no new line text
+ line = [type, line_old, full_line, line_code, next_type, nil, " ", nil]
lines.push(line)
end
elsif type == 'new'
@@ -80,7 +80,7 @@ module DiffHelper
next
else
# Change is only on the right side, left side has no change
- line = [nil, nil, " ", line_code, line_code, type, line_new, full_line]
+ line = [nil, nil, " ", line_code, type, line_new, full_line, line_code]
lines.push(line)
end
end