Verify repo hosted by github before checking API availability #112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation of magit-usable-p checks the API is
available before it checks whether the repo is hosted by github or a
whitelisted hub instance. Since the API availability check utilizes a
cache that is not repo host specific, this defeats the github hosted
check in the case where a mix of github and non-github hosted
repositories are used, resulting in magithub frequently concluding
that magithub is usable on non-github hosted repositories.
This commit fixes the problem for non-github hosted repositories by
moving the check for github or a whitelisted hub instance before the
API availability check. This eliminates the most annoying problem I've
encountered, being prompted for authentication and on repositories
where it will never succeed, having to cancel it, and then tell
magithub to go offline.
However, it does not address a problem when multiple different github
hosts are in use (e.g. github.com and an enterprise github instance)
and the API works on one of them but not the other. For that, the
cache implementation will have to be enhanced to understand multiple
hosts.
Partially fixes issue #110