Merge Request incorrectly rejected by expression in merge commit message
Summary
Customer has encountered an issue where merge commit messages appear to be rejected incorrectly
Steps to reproduce
- Create a project.
- Populate the
Require expression in commit messages
section of thePush Rules
settings of the project with the expression^[A-Z]+-\d+$
. - Make a change in the project with a commit message of
BUGFIX-123
. - Create a merge request.
- Attempt to merge that merge request.
- Observe that the error
Commit message does not follow the pattern '^[A-Z]+-\d+$'. Try again.
is returned.
Example Project
-
push-rules-basic
- Example MR: https://gitlab.com/tw-test-bed/push-rules-basic/-/merge_requests/1
- Screenshot:
The merge commit for this merge request that is being rejected should be:
Merge branch 'test-1' into 'main'
BUGFIX-123
See merge request tw-test-bed/push-rules-basic/-/merge_requests/1
What is the current bug behavior?
Merge Request is rejected because the Merge Request states the message does not match the RegEx.
What is the expected correct behavior?
RegEx should evaluate correctly
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
Edited by Tristan