Do not diff paths changed in merge commits
All threads resolved!
All threads resolved!
When a merge commit passes through our diff checks we would previously check each path changed in the merge commit. However, our diffing logic would return any path that was changed in any parent, meaning changes that are already in history were being detected as new changes.
Gitaly recently introduced a new flag for the FindChangedPaths GRPC to allow us to diff against all_parents, meaning, only new changes in a merge commit would be detected. With new changes meaning a change that did not exist in all of the parents i.e. if a user merges and fixes a merge conflict with code different to any of the parents, or they manually edited, created, or deleted a file during the merge.
This allows us to correctly execute push rules against new changes only.
Fixes #23625 (closed)
Changelog: fixed
Numbered steps to set up and validate the change are strongly suggested.
This push should be rejected saying the file user2 pushed is locked
Enable the feature flag:
Feature.enable(:merge_commit_diff_modes)
Push again, now it should be accepted
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.