summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2019-03-21 14:48:40 +0000
committerDouwe Maan <douwe@gitlab.com>2019-03-21 14:48:40 +0000
commitb36fc6d51d7b70b25be62d3e6a1a2da616975770 (patch)
tree921bb90d68a8de2b5a7f53186ae5fd87ddafdc03 /lib
parent0e54c4402538f56d43317d23efbfc1c361ae21f1 (diff)
parent438485ef88c762b59ee9fb6089d8b7256554fe24 (diff)
downloadgitlab-ce-b36fc6d51d7b70b25be62d3e6a1a2da616975770.tar.gz
Merge branch '59289-fix-push-to-create-protected-branches' into 'master'
Allow users to create protected branches via CLI Closes #59289 See merge request gitlab-org/gitlab-ce!26413
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/checks/branch_check.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/checks/branch_check.rb b/lib/gitlab/checks/branch_check.rb
index ad926739752..1dbd564fb6f 100644
--- a/lib/gitlab/checks/branch_check.rb
+++ b/lib/gitlab/checks/branch_check.rb
@@ -59,6 +59,8 @@ module Gitlab
def protected_branch_creation_checks
logger.log_timed(LOG_MESSAGES[:protected_branch_creation_checks]) do
+ break if user_access.can_push_to_branch?(branch_name)
+
unless user_access.can_merge_to_branch?(branch_name)
raise GitAccess::UnauthorizedError, ERROR_MESSAGES[:create_protected_branch]
end