summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-06-03 12:41:58 +0000
committerDouwe Maan <douwe@gitlab.com>2016-06-03 12:41:58 +0000
commit0e2490c0cb9fca00baac08ae6b1280f62fa7d336 (patch)
tree8511fe1766c450b0a684a3c7d5b0535e85917862 /doc
parent4c8d4c620c1e6af89de2a6e7407ac078744a0dcd (diff)
parent4f726683cb59da54f47302880d5c0c447638402a (diff)
downloadgitlab-ce-0e2490c0cb9fca00baac08ae6b1280f62fa7d336.tar.gz
Merge branch '14139-sha-parameter-in-accept-merge-request-api' into 'master'
Resolve "SHA parameter in accept merge request API" Add a `sha` parameter to the MR merge API, which must match the source SHA for the branch to be merged. Also add the same parameter to the UI: ![MR_SHA](/uploads/616da728695dc19fa7ef7ef6a016ff81/MR_SHA.gif) @DouweM and I discussed adding some smart feature to that, like updating the source SHA on navigating to the diff tab, but for now it will just require a refresh :smiley: Closes #14139. See merge request !4414
Diffstat (limited to 'doc')
-rw-r--r--doc/api/merge_requests.md11
1 files changed, 7 insertions, 4 deletions
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md
index 8217e30fe25..16b892dc3b7 100644
--- a/doc/api/merge_requests.md
+++ b/doc/api/merge_requests.md
@@ -413,11 +413,13 @@ curl -X DELETE -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.c
Merge changes submitted with MR using this API.
-If merge success you get `200 OK`.
+If the merge succeeds you'll get a `200 OK`.
-If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged'
+If it has some conflicts and can not be merged - you'll get a 405 and the error message 'Branch cannot be merged'
-If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed'
+If merge request is already merged or closed - you'll get a 406 and the error message 'Method Not Allowed'
+
+If the `sha` parameter is passed and does not match the HEAD of the source - you'll get a 409 and the error message 'SHA does not match HEAD of source branch'
If you don't have permissions to accept this merge request - you'll get a 401
@@ -431,7 +433,8 @@ Parameters:
- `merge_request_id` (required) - ID of MR
- `merge_commit_message` (optional) - Custom merge commit message
- `should_remove_source_branch` (optional) - if `true` removes the source branch
-- `merged_when_build_succeeds` (optional) - if `true` the MR is merge when the build succeeds
+- `merged_when_build_succeeds` (optional) - if `true` the MR is merged when the build succeeds
+- `sha` (optional) - if present, then this SHA must match the HEAD of the source branch, otherwise the merge will fail
```json
{