"Something went wrong during merge pre-receive hook" on merge request due to the "Prevent committing secrets to Git" setting on upstream

Summary

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.

Example Project

gitlab-org-gitlab-ee-issue/gitlab-ee-issue!3

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

image

Output of checks

This bug happens on GitLab.com

Possible fixes

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.

Customers

https://gitlab.my.salesforce.com/0016100001CXro6

Edited Sep 02, 2020 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading