diff options
-rw-r--r-- | app/models/merge_request_diff.rb | 2 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 74583af1a29..6f1beede6f9 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -142,7 +142,7 @@ class MergeRequestDiff < ActiveRecord::Base end def commits_by_shas(shas) - return [] unless shas.present? + return MergeRequestDiffCommit.none unless shas.present? merge_request_diff_commits.where(sha: shas) end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index c7202b481d3..131db6a5ff9 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -2651,6 +2651,10 @@ describe MergeRequest do describe '#includes_any_commits?' do it 'returns false' do + expect(subject.includes_any_commits?([])).to be_falsey + end + + it 'returns false' do expect(subject.includes_any_commits?([Gitlab::Git::BLANK_SHA])).to be_falsey end |