Currently, there is no possibility to retrieve the branch a commit was pushed to via the API.
Suppose you have the id of a commit and you want to know the branch, you can't get the branch name by asking the API. The commit data returned by http://docs.gitlab.com/ce/api/commits.html#get-a-single-commit does not include branch information. Therefore, the only way to get the branch is retrieving all branches (in the worst case) and searching for the commit.
Solution to this problem would be including a 'branch_name' field in commit data delivered by the API.
Designs
An error occurred while loading designs. Please try again.
Child items 0
Show closed items
GraphQL error: The resource that you are attempting to access does not exist or you don't have permission to perform this action
No child items are currently open.
Linked items 0
Link issues together to show that they're related or that one is blocking others.
Learn more.
Activity
Sort or filter
Newest first
Oldest first
Show all activity
Show comments only
Show history only
ChrisChanged title: There is no possibility to get the branch name with the commit sha via the API → Include 'branch_name' in the commit data provided by the API
Changed title: There is no possibility to get the branch name with the commit sha via the API → Include 'branch_name' in the commit data provided by the API
A commit can be on multiple branches, so it should be a list of branch names. Should it only be included if it is the HEAD of a branch or if it is contained in a branch (and not the default branch)?
Actually, tags should be included too while we're at it. I think it'd be fine to just give the list show in the commit page (the list beside the parents entry)
First of all, thank you for raising an issue to help improve the GitLab product. This issue was labelled as a ~"feature proposal" in the past. In order to maintain order in the issue tracker, we are starting to close off old, unpopular feature proposals that have not gained many votes since opening.
This issue will be marked for closure, as it meets the following criteria:
Created over 1 year ago
Labelled as a ~"feature proposal"
Unscheduled (not associated with a milestone)
Less than 10 upvotes
Thanks for your help and please raise any new feature proposals as a new issue.
@sytses Very little, as long as it's acceptable to Drupal that the branch name(s) will be available in a separate /projects/:org/:repo/commits/:commit/refs endpoint rather than right inside /projects/:org/:repo/commits/:commit.