[go: up one dir, main page]

Skip to content

Latest SHA for branch (or any REF)

Description

I have several scripts working with github repos where I can update by asking for the latest SHA for an arbitrary branch. In one case the SHA is used as a cache invalidation for the script.

My goal is to achieve the same on GitLab hosted projects.

Proposal

Add support for Accept header on API endpoints, in our case: GET /projects/:id/repository/commits/:ref should be able to accept something like application/vnd.gitlab.VERSION.sha, where VERSION is the API version.

This endpoint should simply return the SHA of the latest commit in this REF, whether branch or tag, in case of an actual SHA, the returned SHA will simply be identicatl, but that is the user's issue...

Links / references

This is Github's content-type: https://developer.github.com/v3/media/#sha

At the time of writing this issue, I ran this call:

$ curl 'https://api.github.com/repos/gitlabhq/gitlabhq/commits/master' -H 'Accept: application/vnd.github.v3.sha'                                        
e1de8a77d5d9749eaa596bfa15e6d11f1828db95
Edited by Yehuda Deutsch