While this code works fine for most use cases:
|
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference); |
It looks like that GET /refs/{ref} is an undocumented endpoint and it returns an array of references when an exact reference is not found, but other similar references are found in the repo.
Current GitHub docs tells to use GET /ref/{ref} URL: https://docs.github.com/en/rest/reference/git#get-a-reference
My story: I have the following references in the repo:
- accepted-1-1
- accepted-1-1-1
When I try to get accepted-1 reference using references()->show(..) I get the following response, but I expect zero results:

If I change GET /refs/{ref} to GET /ref/{ref} in References.php it starts throwing a 404 not found exception as expected.
While this code works fine for most use cases:
php-github-api/lib/Github/Api/GitData/References.php
Line 83 in de2f278
It looks like that
GET /refs/{ref}is an undocumented endpoint and it returns an array of references when an exact reference is not found, but other similar references are found in the repo.My story: I have the following references in the repo:
When I try to get
accepted-1reference usingreferences()->show(..)I get the following response, but I expect zero results:If I change
GET /refs/{ref}toGET /ref/{ref}inReferences.phpit starts throwing a 404 not found exception as expected.