"Something went wrong during merge pre-receive hook" on merge request due to the "Prevent committing secrets to Git" setting on upstream
If a user disables the "Prevent committing secrets to Git" setting in their fork and commits a secret, the merge request will fail to merge with a misleading error:
Something went wrong during merge pre-receive hook.
Steps to reproduce
Create a repository in a group. Fork the repository. Turn on "Prevent committing secrets to Git" in the upstream repository. On the fork, create an
id_rsa file, and file a merge request against the upstream repository. Attempt to merge the merge request.
What is the current bug behavior?
A misleading error occurs during the merge.
What is the expected correct behavior?
An error similar to the one that occurs when you try to push secrets directly to a repository that doesn't allow secrets.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
I only have a high level proposal of use the same logic path for pushing a commit in general for merging a request from a fork.