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:
authorMarin Jankovski <marin@gitlab.com>2014-09-04 13:25:14 +0400
committerMarin Jankovski <marin@gitlab.com>2014-09-08 11:05:16 +0400
commitf827482c12b3aeec2ed5f60afbf7c676e27435e3 (patch)
treeea03e00b15d4f5f4c3b42a7aec7ff3ee95840113 /lib/gitlab
parent1067b00724c045b4fa46a9f8ff5acd09d65553e0 (diff)
Remove duplication, expand for next_line.
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/diff_parser.rb43
1 files changed, 1 insertions, 42 deletions
diff --git a/lib/gitlab/diff_parser.rb b/lib/gitlab/diff_parser.rb
index baec2e63baa..f226692a63c 100644
--- a/lib/gitlab/diff_parser.rb
+++ b/lib/gitlab/diff_parser.rb
@@ -15,47 +15,6 @@ module Gitlab
type = nil
lines_arr = ::Gitlab::InlineDiff.processing lines
- lines_arr.each do |line|
- raw_line = line.dup
-
- next if filename?(line)
-
- full_line = html_escape(line.gsub(/\n/, ''))
- full_line = ::Gitlab::InlineDiff.replace_markers full_line
-
- if line.match(/^@@ -/)
- type = "match"
-
- line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
- line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
-
- next if line_old == 1 && line_new == 1 #top of file
- yield(full_line, type, nil, line_new, line_old)
- next
- else
- type = identification_type(line)
- line_code = generate_line_code(new_path, line_new, line_old)
- yield(full_line, type, line_code, line_new, line_old, raw_line)
- end
-
-
- if line[0] == "+"
- line_new += 1
- elsif line[0] == "-"
- line_old += 1
- else
- line_new += 1
- line_old += 1
- end
- end
- end
-
- def each_for_parallel
- line_old = 1
- line_new = 1
- type = nil
-
- lines_arr = ::Gitlab::InlineDiff.processing lines
lines_arr.each_cons(2) do |line, next_line|
raw_line = line.dup
@@ -80,7 +39,7 @@ module Gitlab
else
type = identification_type(line)
line_code = generate_line_code(new_path, line_new, line_old)
- yield(full_line, type, line_code, line_new, line_old, next_line)
+ yield(full_line, type, line_code, line_new, line_old, raw_line, next_line)
end