Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
b325c9e0a705
Commit
b325c9e0
authored
Dec 26, 2014
by
Marin Jankovski
Browse files
Allow regular code push for developers if the protected branch allows it.
parent
24df62780007
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
b325c9e0
...
...
@@ -470,6 +470,10 @@
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
...
...
lib/gitlab/git_access.rb
View file @
b325c9e0
...
...
@@ -85,6 +85,8 @@
# 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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment