Skip to content

Fix conflict highlighting

Sean McGivern requested to merge fix-conflict-highlighting into master

What does this MR do?

Fixes conflict highlighting in 10.2. No issue, @DouweM just noticed it.

Are there points in the code the reviewer needs to double check?

The spec is ugly, but the best option I can think of.

Why was this MR needed?

Before https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14747, conflicts used a Repository. Then, when highlighting, #gitattribute got called on that repository, to find a custom language if needed.

After that MR, we were now using a Gitlab::Git::Repository instead, which didn't have a #gitattribute method. Gitlab::Highlight has an unconditional rescue that falls back to plain text, so nothing blew up - conflicts were just not syntax-highlighted.

Merge request reports