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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
93d3c61e
Commit
93d3c61e
authored
Nov 30, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs when full ref is passed to protected_for
parent
0f00c781
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
app/models/project.rb
app/models/project.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+21
-1
No files found.
app/models/project.rb
View file @
93d3c61e
...
...
@@ -1740,7 +1740,7 @@ class Project < ActiveRecord::Base
return
false
if
ref
.
nil?
raise
Repository
::
AmbiguousRefError
if
repository
.
ambiguous_ref?
(
ref
)
resolved_ref
=
repository
.
expand_ref
(
ref
)
resolved_ref
=
repository
.
expand_ref
(
ref
)
||
ref
ref_name
=
Gitlab
::
Git
.
ref_name
(
resolved_ref
)
if
Gitlab
::
Git
.
branch_ref?
(
resolved_ref
)
...
...
spec/models/project_spec.rb
View file @
93d3c61e
...
...
@@ -2625,7 +2625,27 @@ describe Project do
end
end
context
'when ref name is a full branch ref'
do
context
'when ref is a full ref'
do
let
(
:ref
)
{
'refs/heads/master'
}
context
'when ref is not protected'
do
it
'returns false'
do
is_expected
.
to
be_falsey
end
end
context
'when ref is protected'
do
before
do
create
(
:protected_branch
,
name:
'master'
,
project:
project
)
end
it
'returns true'
do
is_expected
.
to
be_truthy
end
end
end
context
'when ref name is a full tag ref'
do
let
(
:ref
)
{
'refs/tags/something'
}
before
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