Ignore Merge Commits For Merge Request Acceptance
When working in gitlab merge commits are made any time a merge request is approved. These commits are created for the user that approved the merge request.
Imagine a scenario where you have 2 engineers working on a project. Engineer 1 creates a MR to master. Engineer 2 approves it, creating a merge commit on master. Engineer 1 now updates with master, pulling the new merge commit by Engineer 2, and starts work on a feature. They push this feature and create a merge request to develop. This work now contains the feature commits by Engineer 1 and the merge commit from Engineer 2. Neither engineer will be able approve the merge request created for develop since both are on the commit history.
Possible solutions:
- Create a system user that is used for all gitlab merges done to code that references the user that executed it in the commit message.
- Ignore merge commits for purposes of determining authorization to approve a merge request.
- Add a setting for a regex expression to match commit messages and ignore them when determining authorization to approve a merge request.
Edited by Mark Fletcher