"Remove source branch" does not remove for manual merge
Summary
"Remove source branch when merge request is accepted" does not remove the branch when manual merge is performed.
Steps to reproduce
- Create a merge request and check "Remove source branch when merge request is accepted" option.
- Merge branch manually
- Push
What is the current bug behavior?
Source branch is not removed.
What is the expected correct behavior?
Source branch is removed
Possible fixes
When we process changes from a manual merge the method responsible for closing merge requests is MergeRequests::RefreshService#close_merge_requests
. It calls MergeRequests::PostMergeService#execute
. The code responsible for removing the source branch is in MergeRequests::MergeService#after_merge
. This service is only called on a merge via web UI. We should push code responsible for removing the source branch to MergeRequests::PostMergeService#execute
.