diff options
author | Stan Hu <stanhu@gmail.com> | 2018-11-12 18:44:33 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-11-12 19:46:38 +0300 |
commit | b0535009029a24d58eaea8a02768b4fbd0fd8f66 (patch) | |
tree | ee144583946d8d18da2a00670c0f7f2fcd2006e2 /app/models/merge_request_diff.rb | |
parent | a407bba81a3fbd8b3313bc84e1ddf0ab4415207d (diff) |
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 'app/models/merge_request_diff.rb')
-rw-r--r-- | app/models/merge_request_diff.rb | 2 |
1 files changed, 1 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 |