Azure / Azure/azure-rest-api-specs
[BUG] branches stats fails if there are no branches in the repo
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
### API Spec link
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/stats/list?view=azure-devops-rest-7.1&tabs=HTTP
### API Spec version
7.1-preview.1
### Describe the bug
I have a git repository with no branches.
Calling `{organization}/{project}/_apis/git/repositories/{repositoryId}/stats/branches` returns with a 400 error.
### Expected behavior
An empty list is returned. E.g.:
```
{
"count": 0,
"value": []
}
```
### Actual behavior
An error is returned:
```
{
"$id": "1",
"innerException": null,
"message": "VS403403: Cannot find any branches for the reposynctest repository.",
"typeName": "System.ArgumentException, mscorlib",
"typeKey": "ArgumentException",
"errorCode": 0,
"eventId": 0
}
```
### Reproduction Steps
- Create a repository.
- Delete all branches.
- Call the endpoint.
### Environment
_No response_
Contributor guide
Research direction
Start by reproducing the Azure DevOps Git stats branches endpoint at `{organization}/{project}/_apis/git/repositories/{repositoryId}/stats/branches` after deleting all branches, using the linked API specification as context. Done means the endpoint returns HTTP success with `{ "count": 0, "value": [] }` instead of a 400 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100