Commit 09d8c77a authored by Matija Čupić's avatar Matija Čupić

Prevent checking protected_ref? for ambiguous refs

parent dedaec13
......@@ -53,6 +53,8 @@ module Gitlab
end
def protected_ref?
return if ambiguous_ref?
strong_memoize(:protected_ref) do
project.protected_for?(origin_ref)
end
......
......@@ -181,6 +181,17 @@ describe Gitlab::Ci::Pipeline::Chain::Command do
it { is_expected.to eq(false) }
end
context 'when ref is ambiguous' do
before do
project.repository.add_tag(project.creator, 'ref', 'master')
project.repository.add_branch(project.creator, 'ref', 'master')
end
it 'does not raise an error' do
expect { subject }.not_to raise_error
end
end
end
describe '#ambiguous_ref' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment