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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
9f6d228d
Commit
9f6d228d
authored
Nov 26, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify conditionals in Project#protected_ref?
parent
d27de096
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
app/models/project.rb
app/models/project.rb
+6
-2
No files found.
app/models/project.rb
View file @
9f6d228d
...
...
@@ -1737,10 +1737,14 @@ class Project < ActiveRecord::Base
end
def
protected_for?
(
ref
)
return
false
unless
ref
&&
!
repository
.
ambiguous_ref?
(
ref
)
return
false
if
ref
.
nil?
||
repository
.
ambiguous_ref?
(
ref
)
resolved_ref
=
repository
.
resolve_ref
(
ref
)
ref_name
=
resolved_ref
==
ref
?
Gitlab
::
Git
.
ref_name
(
resolved_ref
)
:
ref
ref_name
=
if
resolved_ref
==
ref
Gitlab
::
Git
.
ref_name
(
resolved_ref
)
else
ref
end
if
Gitlab
::
Git
.
branch_ref?
(
resolved_ref
)
ProtectedBranch
.
protected?
(
self
,
ref_name
)
...
...
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