diff options
author | Stan Hu <stanhu@gmail.com> | 2018-11-12 07:44:33 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-11-12 08:46:38 -0800 |
commit | b0535009029a24d58eaea8a02768b4fbd0fd8f66 (patch) | |
tree | ee144583946d8d18da2a00670c0f7f2fcd2006e2 /spec/models/merge_request_spec.rb | |
parent | a407bba81a3fbd8b3313bc84e1ddf0ab4415207d (diff) | |
download | gitlab-ce-b0535009029a24d58eaea8a02768b4fbd0fd8f66.tar.gz |
Fix MergeRequestService erroring out on deleted branch
When a branch is deleted, the push commit IDs is an empty array.
The previous change would attempt to call `[].exists?`, which is
invalid. Fix this by returning `MergeRequestDiffCommit.none` instead.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/53853
Diffstat (limited to 'spec/models/merge_request_spec.rb')
-rw-r--r-- | spec/models/merge_request_spec.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 |