diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-09 15:11:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-09 15:11:57 +0300 |
commit | 1f229cdc22b5b32989bcff2037d8925c75703671 (patch) | |
tree | c92e9dff7737e78d7331518cdf69f90403af09ea /lib/gitlab/diff | |
parent | 7a98d989740ec85982cdb6c1d57c8f24270e455e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r-- | lib/gitlab/diff/parser.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab/diff/parser.rb b/lib/gitlab/diff/parser.rb index adb711ca89f..924c28e3db5 100644 --- a/lib/gitlab/diff/parser.rb +++ b/lib/gitlab/diff/parser.rb @@ -28,9 +28,11 @@ module Gitlab if line =~ /^@@ -/ 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 + diff_hunk = Gitlab::WordDiff::Segments::DiffHunk.new(line) + line_old = diff_hunk.pos_old + line_new = diff_hunk.pos_new + # not using diff_hunk.first_line? because of defaults next if line_old <= 1 && line_new <= 1 # top of file yielder << Gitlab::Diff::Line.new(full_line, type, line_obj_index, line_old, line_new, parent_file: diff_file) |