summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2018-06-13 15:23:34 +0200
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-06-13 15:23:34 +0200
commite4a9b0771abdcd4e478cfc763ca7fcecc99ae505 (patch)
tree5ce244b20532de3d1f11fcd9672304862ef45cb9 /spec/lib
parent7fc47faeb6dc5d92a69ddb8c22a8b2fd4dda2247 (diff)
downloadgitlab-ce-e4a9b0771abdcd4e478cfc763ca7fcecc99ae505.tar.gz
ListCommitByOid isn't called with an empty batch
Batching commits for performance improvements, might lead to empty batches being used. This isn't the case yet, but to guard against this in future cases, a guard clause is added.
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/git/commit_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb
index 5af982c7a54..ae69a362dda 100644
--- a/spec/lib/gitlab/git/commit_spec.rb
+++ b/spec/lib/gitlab/git/commit_spec.rb
@@ -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' }