Fix for issue #25 - Add support for branches with '/' in them
This pull request updates github.js to use the branches API to split the filepath from the branch path and use them both accordingly in calls to /contents and /commits. This means we don't have to naively try and pull the sha variable from the path anymore.
@pomber It looks like the build is failing because of an existing problem in master with prettier and ReadMe.md
Thanks @matt-watson90 . I see two problems with this approach:
-
the sha from the url is not always a branch, take for example this: https://github.githistory.xyz/pomber/git-history/blob/941a28ad39703bd96b3b46a87f8a7d0e253affb5/package.json https://deploy-preview-72--github-history.netlify.com/pomber/git-history/blob/941a28ad39703bd96b3b46a87f8a7d0e253affb5/package.json It works with the current version but not with the PR version.
-
we are adding one more request to the critical path, for something that is an edge case
Maybe we could try your approach after there is a 404. Keep the current approach, if the commits request respond with a 404, get the list of branches and see if we've got the sha/path wrong and try again.
What do you think?
I hadn’t considered that first problem, that’s a good spot.
I agree with your solution. I’ll see what I can implement tonight (or maybe tomorrow)