Commit 7838317a authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix_39233' into 'master'

fix #39233 - 500 in merge request

Closes #39233

See merge request gitlab-org/gitlab-ce!15774
parents af4d4e70 b7a5125f
---
title: 'fix #39233 - 500 in merge request'
merge_request: 15774
author: Martin Nowak
type: fixed
...@@ -70,7 +70,7 @@ module Gitlab ...@@ -70,7 +70,7 @@ module Gitlab
def find_changed_line_pairs(lines) def find_changed_line_pairs(lines)
# Prefixes of all diff lines, indicating their types # Prefixes of all diff lines, indicating their types
# For example: `" - + -+ ---+++ --+ -++"` # For example: `" - + -+ ---+++ --+ -++"`
line_prefixes = lines.each_with_object("") { |line, s| s << line[0] }.gsub(/[^ +-]/, ' ') line_prefixes = lines.each_with_object("") { |line, s| s << (line[0] || ' ') }.gsub(/[^ +-]/, ' ')
changed_line_pairs = [] changed_line_pairs = []
line_prefixes.scan(LINE_PAIRS_PATTERN) do line_prefixes.scan(LINE_PAIRS_PATTERN) do
......
...@@ -31,6 +31,10 @@ describe Gitlab::Diff::InlineDiff do ...@@ -31,6 +31,10 @@ describe Gitlab::Diff::InlineDiff do
expect(subject[7]).to eq([17..17]) expect(subject[7]).to eq([17..17])
expect(subject[8]).to be_nil expect(subject[8]).to be_nil
end end
it 'can handle unchanged empty lines' do
expect { described_class.for_lines(['- bar', '+ baz', '']) }.not_to raise_error
end
end end
describe "#inline_diffs" do describe "#inline_diffs" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment