Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify repo hosted by github before checking API availability #112

Merged
merged 1 commit into from
Jul 30, 2017

Conversation

kamidon
Copy link

@kamidon kamidon commented Jul 13, 2017

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

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 vermiculus#110
Copy link
Owner

@vermiculus vermiculus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Succinct change and a great commit message; thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants