Azure / Azure/azure-rest-api-specs
[BUG] Get commitsBatch does not traverse the git history fully
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 424
Description
### API Spec link
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits-batch?view=azure-devops-rest-7.2&tabs=HTTP
### API Spec version
7.1
### Describe the bug
let there be two commits "d926c886eaa6bc5e765840f77c8cbfbd82db1910" (newer) and "65a7bc018019d195f14542ce6b36c32f0ccad79c" (older) that are in the same repo and that are in two different branches that have developped in paralell and that have not been merged ever (the only common ancestor revision is at the creation of the branch with the older commit.
attempt to get all the changes (git commit messages) in between using the API
### Expected behavior
the git history is traversed "down" from the newer commit to the ancestor node of the branch with the old commit and then "up" to the older commit until the older commit is reached or the maximum number of revisions is reached
### Actual behavior
the git history is only traversed until some midpoint that is NOT the common ancestor but instead some "arbitrary" revision in the "downwards" traversal phase
note that the maximum number of revisions has not been reached
```
$ curl -H "authorization: bearer $token" -H "content-type: application/json" -X POST "https://dev.azure.com/Clarios/SW_Euler/_apis/git/repositories/Euler/commitsbatch?api-version=7.1" --data '{"compareVersion":{"version":"d926c886eaa6bc5e765840f77c8cbfbd82db1910", "versionOptions":"none", "versionType":"commit"}, "itemVersion":{"version":"65a7bc018019d195f14542ce6b36c32f0ccad79c", "versionOptions":"none", "versionType":"commit"}, "$top": 50000}' | jq > response.json && head response.json && tail response.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1201k 100 1201k 100 256 589k 125 0:00:02 0:00:02 --:--:-- 589k
{
"count": 1856,
"value": [
{
"commitId": "d926c886eaa6bc5e765840f77c8cbfbd82db1910",
"author": {
},
"changeCounts": {
"Add": 4,
"Edit": 0,
"Delete": 0
},
"url": "https://dev.azure.com/Clarios/82560627-1b33-4b56-b301-b6adb46c6b51/_apis/git/repositories/4f4f6996-6aaa-4a7c-b9db-9949301a922e/commits/a9cb3fab9a0e1f2e0ce7f78a1d66a1c8c655b127",
"remoteUrl": "https://dev.azure.com/Clarios/SW_Euler/_git/Euler/commit/a9cb3fab9a0e1f2e0ce7f78a1d66a1c8c655b127"
}
]
}
```
### Reproduction Steps
can be taken from actual behavior snippet -- note that due to the nature of the behavior there is no sample project that can feasably be given as an example
### Environment
_No response_
Contributor guide
Research direction
Start with the referenced Azure DevOps Git commitsBatch API specification and compare it with the supplied curl request, commit IDs, and 1,856-item response. Check how the endpoint's comparison and item versions are represented in this repository; done means identifying a spec-level discrepancy or documenting that the reported traversal behavior belongs to the service and cannot be fixed here.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, git, openapi
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100