Fix bug that caused a merge to show an error message
When a project approval rule is created that requires N approvers in the
project (also known as an
always fail with a "Name has already been taken" validation error.
MergeWorker to run again and show different error messages
to the user. If squashing were enabled, users would see, "Merge failed:
Failed to squash. Should be done manually.. Please try again."
Otherwise, users would see, "Merge failed: Merge request is not
mergeable". In both cases, the merge was actually successful.
This error occurred because:
When a merge request is created,
MergeRequests::CreateServicesyncs some project approval rules (e.g. report types) to the list of merge request approvals.
If only the
any_approverrule is present,
ApprovalRules::FinalizeServicewill attempt to create a new merge request approval rule since
To fix this, we don't copy over the merge request rule if one by the same name already exists.
Closes #32477 (closed)