Repository navigation
Honor --host when resolving the repo from the git remote - #183
Merged
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.
When no --repo was given,
resolve.Reporead the git remote and built the forge client for the remote's domain. It ignored--host, even though the flag's help text says it overrides remote detection. So in a repo whose only remote is a self-hosted Gitea,forge --host github.com release create ...(andrepo view, and every other command that resolves the current repo) still went to the Gitea instance.Now
repoFromGitRemoteuses the--hostdomain when one is set and keeps the owner/repo parsed from the remote. Commands that pass--repoare unchanged, and so is the behaviour when--hostisn't given.FORGE_HOSTis deliberately left alone: it still doesn't override an explicit remote, so people who set it globally see no change.Testing: added
TestRepoFromGitRemoteHostOverride. It creates a temp git repo whose origin is ongit.selfhosted.test, sets--host github.com, and checks thatRepo("", "")returns domaingithub.comwith owner/reposomeone/project. Without the fix the test fails because it tries to probe the self-hosted domain; with the fix it passes.go test ./internal/resolve/ ./internal/cli/passes, and gofmt and go vet are clean.🤖 Generated with Claude Code
Fixes #176
This change was prepared with an AI coding agent (Claude) and reviewed by me before submitting. I'm happy to make any changes you'd like.