git-history icon indicating copy to clipboard operation
git-history copied to clipboard

Fix for issue #25 - Add support for branches with '/' in them

Open matt-watson90 opened this issue 6 years ago • 3 comments

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.

matt-watson90 avatar Feb 11 '19 19:02 matt-watson90

@pomber It looks like the build is failing because of an existing problem in master with prettier and ReadMe.md

matt-watson90 avatar Feb 11 '19 19:02 matt-watson90

Thanks @matt-watson90 . I see two problems with this approach:

  1. 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.

  2. 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?

pomber avatar Feb 11 '19 19:02 pomber

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)

matt-watson90 avatar Feb 11 '19 19:02 matt-watson90