Extend the Commits API to permit listing all commits reachable by a ref, EXCLUDING those reachable by another ref
Description
The GitLab Commits API currently defines a List repository commits endpoint which can list all commits reachable by a given ref_name
between two given timestamps, since
and until
.
It would be beneficial if, instead of providing timestamps as values to since
and until
, a user may instead choose to specify a valid reference name (in addition to ref_name
) to be excluded. This would be similar to functionality already supported by the git log
command.
For example, if I wish to list all commits which are reachable by a reference named develop
, but exclude all commits reachable by a reference named master
, I could run the following Git command to achieve this result:
git log develop ^master
However, as far as I can tell, the GitLab Commits API does not currently support this scenario.
Further details
This feature could be used to answer the question: Which commits exist in branch-B but not in branch-A?
For example, this would be useful for displaying all commits which are unique to the current release branch as compared to master, and would give an idea of which changes will be introduced with an upcoming release.
One may also use this feature to compile release notes based on commit messages for a new release.
Additionally, this feature could be used during developer stand-up meetings, in order to display a list of commits between two refs of relevance to the team during their discussions.
Proposal
I propose adding a new, optional request attribute to the List repository commits endpoint:
-
Attribute:
exclude_ref_name
- Type: string
- Required: no
- Description: The name of a repository branch or tag which will have any commits reachable by it excluded from the returned list of commits
The name of the attribute or the description may need to be modified. However, the idea is that this endpoint would return any commits reachable by the ref_name
attribute minus the subset of commits reachable by the exclude_ref_name
attribute.
Links / references
This feature is already present in the Bitbucket API.
On the above linked page, see the mentioned GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master
endpoint. This is a good example of the feature I am describing.