Conversation
A Git URL such as `ssh://git@[::1]/repo.git` supplies `[::1]` as its host. Adding the default SSH port currently produces `[[::1]]:22`, which cannot be dialed. Remove existing brackets before calling `net.JoinHostPort` when no port is present. Tests cover bracketed and bare IPv6 addresses, zone identifiers, explicit ports, IPv4, and hostnames. Signed-off-by: Alexandre Rodrigues <alexandre3ylf@gmail.com>
Karthik-Chowdary
approved these changes
Sep 18, 2026
Karthik-Chowdary
left a comment
There was a problem hiding this comment.
The normalization is correctly limited to the no-port path: SplitHostPort first preserves valid [v6]:port inputs, then existing brackets are removed before JoinHostPort adds the default. This avoids double brackets without changing explicit-port behavior, and the coverage includes bare/bracketed IPv6, zone identifiers, IPv4, and hostnames. I fetched the PR head and independently ran go test -race ./util/sshutil ./util/gitutil; both packages pass.
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.
A Git URL such as
ssh://git@[::1]/repo.gitsupplies[::1]as its host. Adding the default SSH port currently produces[[::1]]:22, which cannot be dialed.Remove existing brackets before calling
net.JoinHostPortwhen no port is present. Tests cover bracketed and bare IPv6 addresses, zone identifiers, explicit ports, IPv4, and hostnames.Validation: regression tests fail before the fix and pass afterward.
go test -race ./util/sshutil ./util/gitutilThe configured golangci-lint checks pass for the changed package(s).