Users who are allowed to push to protected branches can't create a protected branch via command line
Summary
Introduced when this feature was implemented: https://gitlab.com/gitlab-org/gitlab-ce/issues/53361.
As of this writing, the implementation will only allow users who can merge to create protected branches via web and API only.
Users who are allowed to push to a protected branch can't create a protected branch via command line. They should still be allowed. Related to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24969#note_152711220.
Steps to reproduce
- Create a protected branch wildcard (e.g.
release-*
). - Allow Developers to push.
- As a Developer, push a new branch matching the wildcard.
- The push will be rejected.
Example Project
https://gitlab.com/patrickbajao/test-project
What is the current bug behavior?
User who are allowed to push to protected branch can't create a protected branch via CLI.
What is the expected correct behavior?
User who are allowed to push to protected branch should be able create a protected branch via CLI.
Output of checks
This bug happens on GitLab.com
Possible fixes
Gitlab::Checks::BranchCheck#protected_branch_creation_checks
should be skipped if user is allowed to push to branch.