Commit fd5f6166 authored by Pavel Shutsin's avatar Pavel Shutsin Committed by Stan Hu

Make Repository#blobs_at safe

parent 717f5497
......@@ -519,6 +519,8 @@ class Repository
raw_repository.batch_blobs(items, blob_size_limit: blob_size_limit).map do |blob|
Blob.decorate(blob, container)
end
rescue Gitlab::Git::Repository::NoRepository
[]
end
def root_ref
......
......@@ -1679,6 +1679,16 @@ RSpec.describe Repository do
expect(blobs.first.name).to eq('foobar')
expect(blobs.size).to eq(1)
end
context 'when Gitaly returns NoRepository' do
before do
allow(repository.raw_repository).to receive(:batch_blobs).and_raise(Gitlab::Git::Repository::NoRepository)
end
it 'returns empty array' do
expect(repository.blobs_at([%w[master foobar]])).to match_array([])
end
end
end
describe '#root_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