From 2a970e02912a75962ce559ba49252a4696bbfbea Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Fri, 9 Feb 2018 14:41:58 +0100 Subject: Add docs --- changelogs/unreleased/api-refs-for-commit.yml | 5 ++++ doc/api/commits.md | 34 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 changelogs/unreleased/api-refs-for-commit.yml 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 -- cgit v1.2.1