MR conflict resolution view shows git conflict markers instead of UI when using CRLF

Summary

When a project uses CRLF line endings, the diff of the conflict resolution view in a MR will not render with the normal UI and instead show a diff that includes actual git conflict markers (<<<<<<<).

Steps to reproduce

  1. Create new project/repository
  2. Disable autocrlf for the project git config --local core.autocrlf false
  3. Make sure to use CRLF line endings for the Testfile
    • This can be verified by simply running file Testfile, it will say something like "Testfile: Ruby script text, ASCII text, with CRLF line terminators"
    • The dos2unix package contains unix2dos which can be used to convert LF to CRLF if your editor has no setting to save with CRLF
  4. Commit a file
  5. Create a conflict (e.g. remove a bunch of lines in branch1 and change one of those lines in branch2, then create an MR to merge one branch into the other)
  6. Observe "Merge blocked: merge conflicts must be resolved." error on MR
  7. Click "Resolve conflicts" button
  8. Observe "Showing 0 conflict" message on top of diff
  9. Observe git conflict markers (<<<<<<<) in diff

Example Project

There's two example projects, one with CRLF to observe the error and an identical one with LF to see what is supposed to happen:

What is the current bug behavior?

Conflict resolution view in MR is showing incorrect conflict count and git conflict markers instead of visual representation of the conflict

What is the expected correct behavior?

Conflict resolution view in MR is showing correct conflict count and visual representation of the conflict

Relevant logs and/or screenshots

Side-by-side view of working and not working project

image

Output of checks

This bug happens on GitLab.com