Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
61b4214e
Commit
61b4214e
authored
Dec 26, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow regular code push for developers if the protected branch allows it.
parent
b7eb0d17
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
app/models/project.rb
app/models/project.rb
+4
-0
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+2
-0
No files found.
app/models/project.rb
View file @
61b4214e
...
@@ -470,6 +470,10 @@ class Project < ActiveRecord::Base
...
@@ -470,6 +470,10 @@ class Project < ActiveRecord::Base
protected_branches_names
.
include?
(
branch_name
)
protected_branches_names
.
include?
(
branch_name
)
end
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?
def
forked?
!
(
forked_project_link
.
nil?
||
forked_project_link
.
forked_from_project
.
nil?
)
!
(
forked_project_link
.
nil?
||
forked_project_link
.
forked_from_project
.
nil?
)
end
end
...
...
lib/gitlab/git_access.rb
View file @
61b4214e
...
@@ -85,6 +85,8 @@ module Gitlab
...
@@ -85,6 +85,8 @@ module Gitlab
# and we dont allow remove of protected branch
# and we dont allow remove of protected branch
elsif
newrev
==
Gitlab
::
Git
::
BLANK_SHA
elsif
newrev
==
Gitlab
::
Git
::
BLANK_SHA
:remove_protected_branches
:remove_protected_branches
elsif
project
.
developers_can_push_to_protected_branch?
(
branch_name
(
ref
))
:push_code
else
else
:push_code_to_protected_branches
:push_code_to_protected_branches
end
end
...
...
Write
Preview
Markdown
is supported
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