-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Sometime in 20191, GitHub quietly hid the old /repos/:owner/:repo/git/refs[/...] endpoint in favor of two new endpoints that have the same functionality but provide consistent responses:
GET /repos/:owner/:repo/git/ref/:ref- https://developer.github.com/v3/git/refs/#get-a-single-reference; always returns a ref or an errorGET /repos/:owner/:repo/git/matching-refs/:ref- https://developer.github.com/v3/git/refs/#list-matching-references; always returns a (possibly empty) list
I'd like to use these endpoints in the library because the current methods make it awkward to test if a reference exists, but I was unsure what should happen to the existing methods.
-
Modify the existing functions to use the new endpoints.
GetRefwill behave the same but will return different concrete errors in the error cases (i.e. a standardErrorResponsewith a 404 code if the ref does not exist.)GetRefswill mostly behave the same, but will return an empty list instead of an error if no refs match and will duplicate the functionality ofListRefsif an empty refs is used as an argument. The "error on empty" behavior could be retained if desired.ListRefswill behave the same, but is technically redundant.
-
Modify
GetRef, leaveGetRefsandListRefsalone, and add a newListMatchingRefsmethod. I think this will ultimately be confusing, there are 3 methods that do nearly the same thing, two of which are undocumented in the GitHub API. -
Modify
GetRef, removeGetRefsandListRefs, and add a newListMatchingRefsmethod. This matches the API best, but is not backwards compatible and probably won't work for people still using GitHub Enterprise 2.18 and earlier.
What sounds best? I started implementing (1) but realized it might be better to cleanly break the API and add a new method, if breaking backwards compatibility is acceptable. I'm happy to implement whichever you are willing to support.
1The GitHub Enterprise 2.18 docs have the old endpoints, while the 2.19 docs have the new endpoints, putting the change between August and November, although GitHub.com probably got it earlier.