Skip to content
Snippets Groups Projects
Commit 2771d97b authored by Douwe Maan's avatar Douwe Maan Committed by GitLab Release Tools Bot
Browse files

Merge branch 'ee-1979-blobs-at' into 'master'

Fix migration when project repository is missing

See merge request gitlab-org/gitlab-ce!24859

(cherry picked from commit c5d43124)

db35a3ae Fix migration when project repository is missing
parent 666d5b7f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -525,6 +525,8 @@ class Repository
 
# items is an Array like: [[oid, path], [oid1, path1]]
def blobs_at(items)
return [] unless exists?
raw_repository.batch_blobs(items).map { |blob| Blob.decorate(blob, project) }
end
 
Loading
Loading
Loading
Loading
@@ -1237,6 +1237,27 @@ describe Repository do
end
end
 
describe '#blobs_at' do
let(:empty_repository) { create(:project_empty_repo).repository }
it 'returns empty array for an empty repository' do
# rubocop:disable Style/WordArray
expect(empty_repository.blobs_at(['master', 'foobar'])).to eq([])
# rubocop:enable Style/WordArray
end
it 'returns blob array for a non-empty repository' do
repository.create_file(User.last, 'foobar', 'CONTENT', message: 'message', branch_name: 'master')
# rubocop:disable Style/WordArray
blobs = repository.blobs_at([['master', 'foobar']])
# rubocop:enable Style/WordArray
expect(blobs.first.name).to eq('foobar')
expect(blobs.size).to eq(1)
end
end
describe '#root_ref' do
it 'returns a branch name' do
expect(repository.root_ref).to be_an_instance_of(String)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment