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
0f00c781
Commit
0f00c781
authored
Nov 30, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove resolving conditional from protected_for
parent
08942de9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
app/models/project.rb
app/models/project.rb
+2
-7
spec/models/project_spec.rb
spec/models/project_spec.rb
+22
-0
No files found.
app/models/project.rb
View file @
0f00c781
...
...
@@ -1740,13 +1740,8 @@ class Project < ActiveRecord::Base
return
false
if
ref
.
nil?
raise
Repository
::
AmbiguousRefError
if
repository
.
ambiguous_ref?
(
ref
)
if
Gitlab
::
Git
.
branch_ref?
(
ref
)
||
Gitlab
::
Git
.
tag_ref?
(
ref
)
resolved_ref
=
ref
ref_name
=
Gitlab
::
Git
.
ref_name
(
ref
)
else
resolved_ref
=
repository
.
expand_ref
(
ref
)
ref_name
=
ref
end
ref_name
=
Gitlab
::
Git
.
ref_name
(
resolved_ref
)
if
Gitlab
::
Git
.
branch_ref?
(
resolved_ref
)
ProtectedBranch
.
protected?
(
self
,
ref_name
)
...
...
spec/models/project_spec.rb
View file @
0f00c781
...
...
@@ -2624,6 +2624,28 @@ describe Project do
is_expected
.
to
be_truthy
end
end
context
'when ref name is a full branch ref'
do
let
(
:ref
)
{
'refs/tags/something'
}
before
do
project
.
repository
.
add_branch
(
project
.
creator
,
ref
,
'master'
)
end
it
'returns false'
do
is_expected
.
to
be_falsey
end
context
'when ref is a protected branch'
do
before
do
create
(
:protected_branch
,
name:
'refs/tags/something'
,
project:
project
)
end
it
'returns true'
do
is_expected
.
to
be_truthy
end
end
end
end
describe
'#update_project_statistics'
do
...
...
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