Add --remote flag to select which git remote to resolve#57
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #42.
forgepreviously hardcodedoriginas the remote to read when figuring out which forge to talk to. With multiple remotes pointing at different forges (a Giteaoriginand a GitHubmirror, say) there was no way to operate on the second one without-R owner/repo.The new persistent
--remoteflag picks which remote URL to parse. Defaults tooriginso existing behaviour is unchanged.Implementation uses a package-level setter on
internal/resolvecalled fromPersistentPreRun, rather than threading a third parameter through the 75 identicalresolve.Repo(flagRepo, flagForgeType)call sites. The remote name is session-wide state so this fits.The
git remote get-urllookup and URL parse are extracted intoresolveRemote()so they can be tested without the network-touching client construction. Tests use a real temp git repo with two remotes —t.Chdirplusgit initplusgit remote add— and verify that switching the remote name produces a different domain.Error messages now name which remote failed:
reading remote "mirror" (not in a git repo, or remote not configured; use -R or --remote).