Close merge requests and don't refresh merge request when a source branch is deleted
From https://gitlab.com/gitlab-org/gitlab-ce/issues/32812#note_39580785:
Let's say you have a open merge request with source_branch
to master
.
Right now if you delete source_branch
and then push to master
, we attempt to reload master
. Since the ref for source_branch
no longer exists, we end up updating the merge request with an empty diff (for example: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13003). We should:
- Avoid updating the merge request if the source SHA is
nil
- Close open merge requests with that branch
/cc: @smcgivern, @vsizov, @victorwu