diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-30 21:09:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-30 21:09:39 +0300 |
commit | 1b26aaa633642ea33f1fb9d7e8680892c8ca795d (patch) | |
tree | 2f472efc1b86f43857082132ed58e2b24e46ab39 /doc/api/commits.md | |
parent | e65a1b9830b8746fefd18744a39d559cbf58c99e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/api/commits.md')
-rw-r--r-- | doc/api/commits.md | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/doc/api/commits.md b/doc/api/commits.md index 414ad46c9f6..da95e9a943f 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -299,9 +299,10 @@ Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `sha` | string | yes | The commit hash | | `branch` | string | yes | The name of the branch | +| `dry_run` | boolean | no | Does not commit any changes. Default is false. [Introduced in GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/231032) | ```shell curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "branch=master" "https://gitlab.example.com/api/v4/projects/5/repository/commits/master/cherry_pick" @@ -345,6 +346,19 @@ indicates that the commit already exists in the target branch. The other possible error code is `conflict`, which indicates that there was a merge conflict. +When `dry_run` is enabled, the server will attempt to apply the cherry-pick _but +not actually commit any resulting changes_. If the cherry-pick applies cleanly, +the API will respond with `200 OK`: + +```json +{ + "dry_run": "success" +} +``` + +In the event of a failure, you'll see an error identical to a failure without +dry run. + ## Revert a commit > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/22919) in GitLab 11.5. @@ -362,6 +376,7 @@ Parameters: | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `sha` | string | yes | Commit SHA to revert | | `branch` | string | yes | Target branch name | +| `dry_run` | boolean | no | Does not commit any changes. Default is false. [Introduced in GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/231032) | ```shell curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "branch=master" "https://gitlab.example.com/api/v4/projects/5/repository/commits/a738f717824ff53aebad8b090c1b79a14f2bd9e8/revert" @@ -400,6 +415,19 @@ In this case, the revert failed because the attempted revert generated a merge conflict. The other possible error code is `empty`, which indicates that the changeset was empty, likely due to the change having already been reverted. +When `dry_run` is enabled, the server will attempt to apply the revert _but not +actually commit any resulting changes_. If the revert applies cleanly, the API +will respond with `200 OK`: + +```json +{ + "dry_run": "success" +} +``` + +In the event of a failure, you'll see an error identical to a failure without +dry run. + ## Get the diff of a commit Get the diff of a commit in a project. |