Commit 61b4214e authored by Marin Jankovski's avatar Marin Jankovski

Allow regular code push for developers if the protected branch allows it.

parent b7eb0d17
......@@ -470,6 +470,10 @@ class Project < ActiveRecord::Base
protected_branches_names.include?(branch_name)
end
def developers_can_push_to_protected_branch?(branch_name)
protected_branches.map{ |pb| pb.developers_can_push if pb.name == branch_name }.compact.first
end
def forked?
!(forked_project_link.nil? || forked_project_link.forked_from_project.nil?)
end
......
......@@ -85,6 +85,8 @@ module Gitlab
# and we dont allow remove of protected branch
elsif newrev == Gitlab::Git::BLANK_SHA
:remove_protected_branches
elsif project.developers_can_push_to_protected_branch?(branch_name(ref))
:push_code
else
:push_code_to_protected_branches
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment