Loading
Fix Rapid Diffs version self-compare empty state
What does this MR do?
When comparing a merge request version against itself (or against a newer version) in Rapid Diffs, the diff resolver rendered the selected version's full diff instead of the No changes between X and Y empty state.
The legacy diffs controller (find_merge_request_diff_compare) collapses the comparison onto the diff's own head when start_sha does not match a strictly-older version. Gitlab::MergeRequests::DiffResolver was missing this, so it fell through to the full version diff.
This MR:
- Mirrors the legacy self-compare behaviour in
DiffResolver(empty diff → empty state). - Exposes the effective
start_shafrom the resolver and uses it for the target version dropdown, so the compared version resets to match the selected version. - Re-enables the two version self-compare feature specs skipped during the Rapid Diffs migration.
Part of the Rapid Diffs default-on migration follow-up fixes.
How to reproduce
- Open a merge request with multiple diff versions with Rapid Diffs.
- In the
Compare(target) dropdown pick an older version. - In the version (source) dropdown pick the same or an older version.
- Expected:
No changes between <source> and <target>and the compare dropdown resets to the same version.