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

Fix set-default interactive not showing all remotes #6969

Merged
merged 2 commits into from Feb 7, 2023

Conversation

despreston
Copy link
Contributor

@despreston despreston commented Feb 5, 2023

When running gh repo set-default in interactive mode only 5 remotes
were showing. This change refactors the methods that fetch the info for
those remotes. The methods now expect a limit to be provided. Passing
0 allows running things with no limit.

Fixes #6854

Note to reviewers

I was unsure if it made sense to start writing tests for context/context.go. Lots going on in that file and it would suck if someone else has a WIP branch to write those tests.

The description I'm leaving for the ResolvedRemotes.NetworkRepos method is questionable and I'd be surprised if someone can't come up with something better.

When running `gh repo set-default` in interactive mode only 5 remotes
were showing. This change refactors the methods that fetch the info for
those remotes. The methods now expect a limit to be provided. Passing
`0` allows running things with no limit.

Fixes cli#6854
@despreston despreston marked this pull request as ready for review February 6, 2023 00:11
@despreston despreston requested a review from a team as a code owner February 6, 2023 00:11
@despreston despreston requested review from samcoe and removed request for a team February 6, 2023 00:11
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Feb 6, 2023
@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI Feb 6, 2023
Copy link
Member

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

@despreston This is coming along nicely, thanks for getting started on this work. I added some code suggestions, mostly style and naming ideas.

As for tests, I don't know of any open PRs that are modifying context/context but I would say that I think the only test that is necessary to be added is one in setdefault_test.go confirming that we are resolving more than 5 remotes. What do you think?

context/context.go Outdated Show resolved Hide resolved
context/context.go Outdated Show resolved Hide resolved
context/context.go Outdated Show resolved Hide resolved
context/context.go Outdated Show resolved Hide resolved
context/context.go Outdated Show resolved Hide resolved
context/context.go Outdated Show resolved Hide resolved
@samcoe samcoe self-assigned this Feb 7, 2023
samcoe
samcoe approved these changes Feb 7, 2023
Copy link
Member

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

@despreston I went ahead and made the changes I suggested and also wrote up a test. I am planning on getting this into the release later today, hope you don't mind my overstep!

The GitHub CLI automation moved this from Needs review 🤔 to Needs to be merged 🎉 Feb 7, 2023
@samcoe samcoe enabled auto-merge (squash) February 7, 2023 23:03
@samcoe samcoe merged commit 94fe6c7 into cli:trunk Feb 7, 2023
6 checks passed
The GitHub CLI automation moved this from Needs to be merged 🎉 to Pending Release 🥚 Feb 7, 2023
@github-actions github-actions bot moved this from Pending Release 🥚 to Done 💤 in The GitHub CLI Feb 8, 2023
@despreston despreston deleted the des-nolimit branch February 8, 2023 15:48
@despreston
Copy link
Contributor Author

@samcoe Not at all, glad I could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external pull request originating outside of the CLI core team
Projects
The GitHub CLI
  
Done 💤
Development

Successfully merging this pull request may close these issues.

OWNER/repo does not correspond to any git remotes
3 participants