Skip to content

Cannot unselect 'Remove source branch' when editing merge request

Summary

If merge request has 'Remove source branch' set that option cannot be removed when editing merge request

Steps to reproduce

  1. Edit / Create merge request with 'Remove source branch' set
  2. Edit merge request again, uncheck and save
  3. Remove source branch is still set

Possible fixes

In https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/views/shared/issuable/_form.html.haml#L145 there is only check_box_tag. Checkbox will only send its value when it's checked and nothing if not.

Adding = hidden_field_tag 'merge_request[force_remove_source_branch]', '0' just before check_box_tag should fix this.

Rails form.check_box will autogenerate that hidden input field but check_box_tag doesn't.