Raise an error on ambiguous refs
This commit is contained in:
parent
dfe7f57eef
commit
08942de9b6
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
#
|
||||
|
|
|
@ -2583,8 +2583,8 @@ describe Project do
|
|||
project.repository.add_tag(project.creator, ref, 'master')
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
is_expected.to be_falsey
|
||||
it 'raises an error' do
|
||||
expect { subject }.to raise_error(Repository::AmbiguousRefError)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue