Commit 21a3a3e1 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'sh-fix-refresh-service-deleted-branch' into 'master'

Fix MergeRequestService erroring out on deleted branch

Closes #53853

See merge request gitlab-org/gitlab-ce!22989
parents 0ff34e77 b0535009
......@@ -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
......
......@@ -2650,6 +2650,10 @@ describe MergeRequest do
end
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
......
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