Skip to content

Fallback to Diff::File#diff_lines_for_serializer when limit is hit

Patrick Bajao requested to merge 360010-conflicts-diff-fallback into master

What does this MR do and why?

When parsing conflict file, we have a limit of 200kb. When file exceeds that size a Gitlab::Git::Conflict::Parser::UnmergeableFile exception gets raised. It's not being handled anywhere so when we display conflicts on diffs, it errors out the entire diff.

To fix this, we rescue the exception and fallback to the corresponding diff file's #diff_lines_for_serializer. This way, we'll still be able to show the diff when it occurs.

This is behind display_merge_conflicts_in_diff feature flag.

Related #360010 (closed)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kai Armstrong

Merge request reports