Gitlab "remove source branch" is not working as expected

Summary

While creating a merge request, remove source branch check box is selected and merge request is merged via API. In this case source branch is not getting removed.

Steps to reproduce

  1. Create a merge request
  2. Select Remove source branch check box
  3. Send API request to merge the MR. {{curl -X PUT -H "PRIVATE-TOKEN:XXXXXXXXXX" "https://gitlab.com/api/v4/projects/project_id/merge_requests/merge_id/merge"}}
  4. You'll see MR is merged, but the source branch is not removed.
  5. We have manually delete the source branch.

Example Project

(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)

(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)

What is the current bug behavior?

Source branch is not removed after merging the MR.

What is the expected correct behavior?

Source branch is removed, when MR is merged.

Relevant logs and/or screenshots

Started GET "/api/v4/projects/project_id/approval_settings" for 10.242.xxx.xxx at 2019-09-18 02:01:16 -0700 Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "merge_request"=>{"title"=>"Update README.md", "description"=>"", "assignee_id"=>"", "label_ids"=>[""], "approvals_before_merge"=>"0", "force_remove_source_branch"=>"1", "squash"=>"0", "lock_version"=>"", "source_project_id"=>"project_id", "source_branch"=>"feature/testing2", "target_project_id"=>"project_id", "target_branch"=>"dev"}, "namespace_id"=>"group_name", "project_id"=>"project_name"} Started GET "/api/v4/projects/project_id/merge_requests/merge_id/approvals" for 10.242.xxx.xxx at 2019-09-18 02:01:25 -0700 Started PUT "/api/v4/projects/project_id/merge_requests/merge_id/merge" for 10.9.xxx.xxx at 2019-09-18 02:01:41 -0700

Once the MR is merged via API, it's displayed, we need to delete the source branch. MR_snap

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:env:info)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited Sep 18, 2019 by Manjupriya
Assignee Loading
Time tracking Loading