Commit 38a02976 authored by Phil Hughes's avatar Phil Hughes Committed by Stan Hu

Fix GraphQL tree query erroring when using tags

parent 22d65400
...@@ -70,7 +70,7 @@ module Gitlab ...@@ -70,7 +70,7 @@ module Gitlab
# Lookup for rugged object by oid or ref name # Lookup for rugged object by oid or ref name
def lookup(oid_or_ref_name) def lookup(oid_or_ref_name)
rugged.rev_parse(oid_or_ref_name) rev_parse_target(oid_or_ref_name)
end end
end end
end end
......
...@@ -2381,7 +2381,7 @@ describe Repository do ...@@ -2381,7 +2381,7 @@ describe Repository do
end end
end end
describe '#tree' do shared_examples '#tree' do
context 'using a non-existing repository' do context 'using a non-existing repository' do
before do before do
allow(repository).to receive(:head_commit).and_return(nil) allow(repository).to receive(:head_commit).and_return(nil)
...@@ -2399,10 +2399,17 @@ describe Repository do ...@@ -2399,10 +2399,17 @@ describe Repository do
context 'using an existing repository' do context 'using an existing repository' do
it 'returns a Tree' do it 'returns a Tree' do
expect(repository.tree(:head)).to be_an_instance_of(Tree) expect(repository.tree(:head)).to be_an_instance_of(Tree)
expect(repository.tree('v1.1.1')).to be_an_instance_of(Tree)
end end
end end
end end
it_behaves_like '#tree'
describe '#tree? with Rugged enabled', :enable_rugged do
it_behaves_like '#tree'
end
describe '#size' do describe '#size' do
context 'with a non-existing repository' do context 'with a non-existing repository' do
it 'returns 0' do it 'returns 0' 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