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
- Create new project/repository
- Disable autocrlf for the project
git config --local core.autocrlf false
- 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 containsunix2dos
which can be used to convert LF to CRLF if your editor has no setting to save with CRLF
- This can be verified by simply running
- Commit a file
- 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)
- Observe "Merge blocked: merge conflicts must be resolved." error on MR
- Click "Resolve conflicts" button
- Observe "Showing 0 conflict" message on top of diff
- 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:
- Properly functioning conflict diff view in the LF project
- Broken conflict diff view in the CRLF project
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
Output of checks
This bug happens on GitLab.com