diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2018-02-09 14:41:58 +0100 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2018-02-09 14:59:50 +0100 |
commit | 2a970e02912a75962ce559ba49252a4696bbfbea (patch) | |
tree | 97cf036fe8d5cdcf9e5b6e7ca1cb829ace8fe036 | |
parent | 4cefb568d96c4868404caa14534a4329e2dd887f (diff) | |
download | gitlab-ce-2a970e02912a75962ce559ba49252a4696bbfbea.tar.gz |
Add docs
-rw-r--r-- | changelogs/unreleased/api-refs-for-commit.yml | 5 | ||||
-rw-r--r-- | doc/api/commits.md | 34 |
2 files changed, 39 insertions, 0 deletions
diff --git a/changelogs/unreleased/api-refs-for-commit.yml b/changelogs/unreleased/api-refs-for-commit.yml new file mode 100644 index 00000000000..df8a2b0eccc --- /dev/null +++ b/changelogs/unreleased/api-refs-for-commit.yml @@ -0,0 +1,5 @@ +--- +title: 'API: Get references a commit is pushed to' +merge_request: 15026 +author: Robert Schilling +type: added diff --git a/doc/api/commits.md b/doc/api/commits.md index 63554c63057..3c12906def4 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -198,6 +198,39 @@ Example response: } ``` +## Get references a commit is pushed to + +> [Introduced][ce-15026] in GitLab 10.6 + +Get all references (from branches or tags) a commit is pushed to. + +``` +GET /projects/:id/repository/commits/:sha/refs +``` + +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 +| `sha` | string | yes | The commit hash | +| `type` | string | no | The scope of commits. Possible values `branches`, `tags`, `all`. Default is a `all`. | + +```bash +curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --form "type=all" "https://gitlab.example.com/api/v4/projects/5/repository/commits/5937ac0a7beb003549fc5fd26fc247adbce4a52e/refs" +``` + +Example response: + +```json +[ + {"name": "'test'"}, + {"name": "master"}, + {"name": "v1.1.0"} +] + +``` + ## Cherry pick a commit > [Introduced][ce-8047] in GitLab 8.15. @@ -500,3 +533,4 @@ Example response: [ce-6096]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6096 "Multi-file commit" [ce-8047]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8047 +[ce-15026]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15026 |