summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-02-14 09:58:31 +0000
committerDouwe Maan <douwe@gitlab.com>2018-02-14 09:58:31 +0000
commit7da1a3d7a30976090d437d7a0fcefe7ac2548ab3 (patch)
tree4c818fadad756e0811b1a5b02e1d1cfadd3e4fb1 /doc/api
parentc203c622c5134ea53e7bf9624c9c99b2386869e5 (diff)
parenta724f7e35f9f8ed9692b0f3f4d6c8a62632cdec4 (diff)
downloadgitlab-ce-7da1a3d7a30976090d437d7a0fcefe7ac2548ab3.tar.gz
Merge branch 'api-refs-for-commit' into 'master'
API: Get refs for a particular commit Closes #18014 See merge request gitlab-org/gitlab-ce!15026
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/commits.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/api/commits.md b/doc/api/commits.md
index 63554c63057..2c745d00887 100644
--- a/doc/api/commits.md
+++ b/doc/api/commits.md
@@ -198,6 +198,41 @@ 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.
+The pagination parameters `page` and `per_page` can be used to restrict the list of references.
+
+```
+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 `branch`, `tag`, `all`. Default is `all`. |
+
+```bash
+curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/5/repository/commits/5937ac0a7beb003549fc5fd26fc247adbce4a52e/refs?type=all"
+```
+
+Example response:
+
+```json
+[
+ {"type": "branch", "name": "'test'"},
+ {"type": "branch", "name": "add-balsamiq-file"},
+ {"type": "branch", "name": "wip"},
+ {"type": "tag", "name": "v1.1.0"}
+ ]
+
+```
+
## Cherry pick a commit
> [Introduced][ce-8047] in GitLab 8.15.
@@ -500,3 +535,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