Commit fd100e1e authored by Rubén Dávila's avatar Rubén Dávila

Don't modify "match" diff lines. #3945

parent 8b079315
...@@ -25,7 +25,12 @@ module Gitlab ...@@ -25,7 +25,12 @@ module Gitlab
def update_diff_lines def update_diff_lines
@highlighted_code.lines.each_with_index do |line, i| @highlighted_code.lines.each_with_index do |line, i|
@diff_lines[i].text = "#{@diff_line_prefixes[i]}#{line}" diff_line = @diff_lines[i]
# ignore highlighting for "match" lines
next if diff_line.type == 'match'
diff_line.text = "#{@diff_line_prefixes[i]}#{line}"
end end
@diff_lines @diff_lines
......
...@@ -24,5 +24,10 @@ describe Gitlab::Diff::Highlight, lib: true do ...@@ -24,5 +24,10 @@ describe Gitlab::Diff::Highlight, lib: true do
it 'should keep the inline diff markup' do it 'should keep the inline diff markup' do
expect(diff_lines[5].text).to match(Regexp.new(Regexp.escape('<span class="idiff">RuntimeError, </span>'))) expect(diff_lines[5].text).to match(Regexp.new(Regexp.escape('<span class="idiff">RuntimeError, </span>')))
end end
it 'should not modify "match" lines' do
expect(diff_lines[0].text).to eq('@@ -6,12 +6,18 @@ module Popen')
expect(diff_lines[22].text).to eq('@@ -19,6 +25,7 @@ module Popen')
end
end end
end end
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