Github API Commit Comparison returns 404 when using 2 dot notation

Viewed 121

When I use the Github API Compare Commit endpoint, if I use the two dot notation to compare commit hashes it returns a 404 error.

{
    "message": "Not Found",
    "documentation_url": "https://docs.github.com/rest/reference/repos#compare-two-commits"
}

If I change the API request to be 3 dots with the exact same commit hashes, it works fine. If I use the Github UI and use the two dot notation for the same hashes, the comparison loads fine. Same with three dot notation.

The repo is private, so I can't share it, but the commits are on the same branch and only 2 or 3 commits apart. I have also tried cross branch and that too didn't work in the API with two dots, but worked in the UI.

Example of this issue using a public repo

Github API (Error): https://api.github.com/repos/github/docs/compare/b5938a09373f3d93f8af19209d42ef35240b9eb2..97d8746422f1ff44a21534ee1951429356311ac0
Github UI (Success): https://github.com/github/docs/compare/b5938a09373f3d93f8af19209d42ef35240b9eb2..97d8746422f1ff44a21534ee1951429356311ac0

0 Answers
Related