提交 c102f956 编写于 作者: R Rémy Coutable

Merge branch 'zj-empty-batch-no-rpc' into 'master'

ListCommitByOid isn't called with an empty batch

See merge request gitlab-org/gitlab-ce!19753
......@@ -179,6 +179,8 @@ module Gitlab
end
def list_commits_by_oid(oids)
return [] if oids.empty?
request = Gitaly::ListCommitsByOidRequest.new(repository: @gitaly_repo, oid: oids)
response = GitalyClient.call(@repository.storage, :commit_service, :list_commits_by_oid, request, timeout: GitalyClient.medium_timeout)
......
......@@ -421,6 +421,16 @@ describe Gitlab::Git::Commit, seed_helper: true do
end
end
describe '#batch_by_oid' do
context 'when oids is empty' do
it 'makes no Gitaly request' do
expect(Gitlab::GitalyClient).not_to receive(:call)
described_class.batch_by_oid(repository, [])
end
end
end
shared_examples 'extracting commit signature' do
context 'when the commit is signed' do
let(:commit_id) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册