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

pass apiClient to determineBaseRepo #943

Merged
merged 1 commit into from May 18, 2020
Merged

pass apiClient to determineBaseRepo #943

merged 1 commit into from May 18, 2020

Conversation

vilmibm
Copy link
Contributor

@vilmibm vilmibm commented May 15, 2020

Fixes #914

It is Mislav's and my hypothesis that the failed reauth issue was caused by having multiple
apiClient instances during a command's lifetime. The second apiClients are created inside of
determineBaseRepo; this PR changes determineBaseRepo to just accept a pre-existing apiClient.
It was only creating its own to begin with in an attempt to reduce the length of its function
signature and for no other reason.

Our code had an unspoken assumption that only one apiClient is created
during the course of a command. Violating this assumption is fine in
almost all cases, but not when we need to do a re-auth to add a new
oauth scope to a user's token.

There is likely a more elegant solution to the problem but until then
this changes determineBaseRepo to use an existing apiClient.
@vilmibm vilmibm added this to Backlog 🗒 in The GitHub CLI via automation May 15, 2020
@vilmibm vilmibm moved this from Backlog 🗒 to Needs review 🤔 in The GitHub CLI May 15, 2020
The GitHub CLI automation moved this from Needs review 🤔 to Needs to be merged 🎉 May 18, 2020
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thanks for addressing this!

@mislav mislav merged commit 4d11732 into master May 18, 2020
The GitHub CLI automation moved this from Needs to be merged 🎉 to Pending Release 🥚 May 18, 2020
@mislav mislav mentioned this pull request May 20, 2020
@mislav mislav moved this from Pending Release 🥚 to Done 💤 in The GitHub CLI May 26, 2020
@mislav mislav deleted the reauth-bug branch June 25, 2020 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
The GitHub CLI
  
Done 💤
Development

Successfully merging this pull request may close these issues.

Updated config is not correctly picked up after re-auth
2 participants