diff options
Diffstat (limited to 'lib/api/v3/merge_requests.rb')
-rw-r--r-- | lib/api/v3/merge_requests.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/v3/merge_requests.rb b/lib/api/v3/merge_requests.rb index 9b0f70e2bfe..af5afd1c334 100644 --- a/lib/api/v3/merge_requests.rb +++ b/lib/api/v3/merge_requests.rb @@ -44,6 +44,7 @@ module API optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign the merge request' optional :labels, type: String, desc: 'Comma-separated list of label names' optional :remove_source_branch, type: Boolean, desc: 'Remove source branch when merging' + optional :squash, type: Boolean, desc: 'Squash commits when merging' end end @@ -166,7 +167,7 @@ module API use :optional_params at_least_one_of :title, :target_branch, :description, :assignee_id, :milestone_id, :labels, :state_event, - :remove_source_branch + :remove_source_branch, :squash end put path do Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42127') @@ -195,6 +196,7 @@ module API optional :merge_when_build_succeeds, type: Boolean, desc: 'When true, this merge request will be merged when the build succeeds' optional :sha, type: String, desc: 'When present, must have the HEAD SHA of the source branch' + optional :squash, type: Boolean, desc: 'When true, the commits will be squashed into a single commit on merge' end put "#{path}/merge" do merge_request = find_project_merge_request(params[:merge_request_id]) @@ -211,6 +213,8 @@ module API render_api_error!("SHA does not match HEAD of source branch: #{merge_request.diff_head_sha}", 409) end + merge_request.update(squash: params[:squash]) if params[:squash] + merge_params = { commit_message: params[:merge_commit_message], should_remove_source_branch: params[:should_remove_source_branch] |