Commit c102f956 authored by Rémy Coutable's avatar 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
parents 84b7613f e4a9b077
...@@ -179,6 +179,8 @@ module Gitlab ...@@ -179,6 +179,8 @@ module Gitlab
end end
def list_commits_by_oid(oids) def list_commits_by_oid(oids)
return [] if oids.empty?
request = Gitaly::ListCommitsByOidRequest.new(repository: @gitaly_repo, oid: oids) 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) 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 ...@@ -421,6 +421,16 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
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 shared_examples 'extracting commit signature' do
context 'when the commit is signed' do context 'when the commit is signed' do
let(:commit_id) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } let(:commit_id) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' }
......
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