Commit 37dc9ee7 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 49f4cdff 5a0629b4
---
title: Respect the should_remove_source_branch parameter to the merge API
merge_request: 25525
author:
type: fixed
...@@ -371,11 +371,11 @@ module API ...@@ -371,11 +371,11 @@ module API
merge_request.update(squash: params[:squash]) if params[:squash] merge_request.update(squash: params[:squash]) if params[:squash]
merge_params = { merge_params = HashWithIndifferentAccess.new(
commit_message: params[:merge_commit_message], commit_message: params[:merge_commit_message],
squash_commit_message: params[:squash_commit_message], squash_commit_message: params[:squash_commit_message],
should_remove_source_branch: params[:should_remove_source_branch] should_remove_source_branch: params[:should_remove_source_branch]
} )
if merge_when_pipeline_succeeds && merge_request.head_pipeline && merge_request.head_pipeline.active? if merge_when_pipeline_succeeds && merge_request.head_pipeline && merge_request.head_pipeline.active?
::MergeRequests::MergeWhenPipelineSucceedsService ::MergeRequests::MergeWhenPipelineSucceedsService
......
...@@ -1005,6 +1005,21 @@ describe API::MergeRequests do ...@@ -1005,6 +1005,21 @@ describe API::MergeRequests do
expect(squash_commit.message).to eq(merge_request.default_squash_commit_message) expect(squash_commit.message).to eq(merge_request.default_squash_commit_message)
end end
end end
describe "the should_remove_source_branch param" do
let(:source_repository) { merge_request.source_project.repository }
let(:source_branch) { merge_request.source_branch }
it 'removes the source branch when set' do
put(
api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user),
params: { should_remove_source_branch: true }
)
expect(response).to have_gitlab_http_status(200)
expect(source_repository.branch_exists?(source_branch)).to be_falsy
end
end
end end
describe "PUT /projects/:id/merge_requests/:merge_request_iid" do describe "PUT /projects/:id/merge_requests/:merge_request_iid" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment