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
Boxiang Sun
gitlab-ce
Commits
08942de9
Commit
08942de9
authored
Nov 28, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise an error on ambiguous refs
parent
dfe7f57e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
app/models/project.rb
app/models/project.rb
+2
-1
app/models/repository.rb
app/models/repository.rb
+1
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-2
No files found.
app/models/project.rb
View file @
08942de9
...
...
@@ -1737,7 +1737,8 @@ class Project < ActiveRecord::Base
end
def
protected_for?
(
ref
)
return
false
if
ref
.
nil?
||
repository
.
ambiguous_ref?
(
ref
)
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
...
...
app/models/repository.rb
View file @
08942de9
...
...
@@ -26,6 +26,7 @@ class Repository
delegate
:bundle_to_disk
,
to: :raw_repository
CreateTreeError
=
Class
.
new
(
StandardError
)
AmbiguousRefError
=
Class
.
new
(
StandardError
)
# Methods that cache data from the Git repository.
#
...
...
spec/models/project_spec.rb
View file @
08942de9
...
...
@@ -2583,8 +2583,8 @@ describe Project do
project
.
repository
.
add_tag
(
project
.
creator
,
ref
,
'master'
)
end
it
'r
eturns false
'
do
is_expected
.
to
be_falsey
it
'r
aises an error
'
do
expect
{
subject
}.
to
raise_error
(
Repository
::
AmbiguousRefError
)
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