Push rule violation when merging not throwing error

Summary

When trying to merge with the squash commits option, if the resulting squashed commit violates the commit author email push rule, the Merge button keeps spinning. It times out but never throws an error in the UI.

Steps to reproduce

  1. Under Settings -> Push Rules -> Commit author's email, add push rule e.g. @gitlab.com$
  2. Make multiple commits to a branch, ensuring the commit author's email matches the rule (would pass).
  3. Create a merge request with that branch, and squash commits option on using a GitLab user account where the Commit email is set to an email address that would violate the rule e.g. @gmail.com.
  4. Click on Merge button.

Note 1: This happens as long as the user's commit email violates the push rule at the time of merge. When I create the merge, I had it set to gitlab.com but when attempting to merge, my commit email was set to @mail.com

Note 2: Without trying to squash, since the existing commits pass the rule, it merges fine, but with the squash commits, it's attempting to create a new commit with the MR author's current commit email address, which may violate the push rule.

Example Project

Reproduced in test project (internal).

Originally reported by customer ZD (internal): https://gitlab.zendesk.com/agent/tickets/113292

What is the current bug behavior?

Merge button starts up the loading gif and stays like that:

merging

After waiting a few seconds, it throws a browser console error:

Expand for browser console output
Uncaught (in promise) Error: SIMPLE_POLL_TIMEOUT
    at s (simple_poll.js:10)
    at ready_to_merge.vue:205
s	@	simple_poll.js:10
(anonymous)	@	ready_to_merge.vue:205
Promise.then (async)		
handleMergePolling	@	ready_to_merge.vue:185
(anonymous)	@	ready_to_merge.vue:178
a	@	raven.js:360
setTimeout (async)		
(anonymous)	@	raven.js:1001
s	@	simple_poll.js:8
(anonymous)	@	ready_to_merge.vue:205
Promise.then (async)		
handleMergePolling	@	ready_to_merge.vue:185
(anonymous)	@	ready_to_merge.vue:178
a	@	raven.js:360
setTimeout (async)		
(anonymous)	@	raven.js:1001
s	@	simple_poll.js:8
(anonymous)	@	ready_to_merge.vue:205
Promise.then (async)		
handleMergePolling	@	ready_to_merge.vue:185
(anonymous)	@	ready_to_merge.vue:178
... (the raven.js and simple_poll.js errors repeat)

What is the expected correct behavior?

Throw some kind of error to say that the user is not allowed to do that, similar to when you try to commit with an invalid email:

error for invalid email on commit

Output of checks

GitLab.com, GitLab Enterprise Edition 11.7.4-ee

Workaround

To get this working you can uncheck the squash commits option at the time of merge and it will work as expected.

Edited Mar 24, 2020 by Cynthia "Arty" Ng
Assignee Loading
Time tracking Loading