Reload HEAD diff when MR is marked as mergeable
What does this MR do and why?
When syncing code owner rules, we are only looking for HEAD diff if MR is mergeable.
However, before this fix, we reload the HEAD diff and sync code owner rules before a MR gets marked as mergeable. That results to code owner rules not being based on the HEAD diff even if the MR is mergeable.
To fix it, we reload the HEAD diff by calling MergeRequests::ReloadMergeHeadDiffService
after a MR gets marked as mergeable.
This way, if MR is mergeable, the HEAD diff is reloaded and code owner rules gets synced based off the updated HEAD diff. If MR is not mergeable, we don't reload the HEAD diff since we don't display it if MR is not mergeable.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- Create CODEOWNERS.
- Enable codeowner approvals for
main
. - Create MR with file that is not owned by any CODEOWNER.
- Update MR source branch to update files owned by CODEOWNER.
- Apply the same change on one of the files owned by CODEOWNER on target branch (in this case it's
main
). - View the "Changes" tab. The file that was also changed on
main
won't be displayed. - View the approval rules. The CODEOWNER approval rule for the file that is no longer present on the diff should not show up anymore.
Related to #444566 (closed)