Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.5k stars 4.93k forks source link

[BUG] branches stats fails if there are no branches in the repo #29648

Open b4rd opened 2 days ago

b4rd commented 2 days ago

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

Environment

No response

v-jiaodi commented 2 days ago

@anuragc617 Please help take a look, thanks.