MR Changes view show already-deleted folder when source branch has conflicts

Summary

When the source branch both deletes a folder AND introduces a conflict with the destination branch, both the Merge Request Changes view incorrectly displays the already-deleted folder as a change. This behavior is inconsistent with git diff output, which correctly filters out the deleted folder regardless of MR conflict status.

Steps to Reproduce

  1. Create a repository with a folder to be deleted
  2. Create two branches from the same commit:
    • Destination branch (destination): Delete the folder in one commit
    • Source branch (source-conflict):
      • Delete the same folder in one commit
      • Introduce a conflict with the destination branch in another file
  3. Create a merge request from source-conflict to destination
  4. Navigate to the Changes tab of the merge request
  5. Observe the diff output in both locations

Public reproduction case available at:

Current Behavior

In MR Changes view:

  • Shows deletion of folder-to-delete as a change
  • This occurs even though folder-to-delete is not present in either:
    • Source branch: source-conflict
    • Destination branch: destination
  • The folder was deleted in both branches, but the MR view shows it as a change

Expected Behavior

  1. MR Changes view should match git diff output and NOT show the deleted folder regardless of MR introduces conflicting changes or not
  2. Only actual differences between branches should be displayed
  3. Both features should use the same diff calculation logic
  4. Deleted folders that don't exist in either branch should not appear in the diff

GitLab Version

  • Reproducible on: GitLab.com (confirmed)

Logs/Screenshots

Reproduction Details:

  • MR !1: Shows changes correctly (no conflict scenario)
  • MR !2: Demonstrates the bug (source branch deletes folder AND introduces conflict)
  • Git diff: Produces correct output without showing deleted folder
  • Compare Revisions: Also shows the deleted folder incorrectly

image

image

image

Impact

  • Severity: Makes branch comparison confusing and obscures actual conflicts

Additional Context

  • Customer Impact: Large account with Ultimate tier affected.

Internal customer ticket

Edited by Kate Grechishkina