fix: resolve SCP-like submodule URLs via transport.NewEndpoint#514
Draft
mafredri wants to merge 1 commit into
Draft
fix: resolve SCP-like submodule URLs via transport.NewEndpoint#514mafredri wants to merge 1 commit into
mafredri wants to merge 1 commit into
Conversation
Use go-git's transport.NewEndpoint to parse parent URLs in ResolveSubmoduleURL. It accepts SCP-like syntax (git@host:path) natively, including the host:port:path form, so the special-case guard for SCP URLs and the documented #492 limitation can be removed. Test changes: - Drop badParent (transport.NewEndpoint accepts ://bad as file proto). - Replace scpParentWithRelativeSubmodule expectErr case with passing scpRelativeSibling, plus scpRelativeChild, scpMultiLevelUp, scpWithPort, and httpsMultiLevelUp. Implements suggestions from mafredri review threads PRRT_kwDOJPSNMM5vANV5 and PRRC_kwDOJPSNMM6oMqCV.
bjornrobertsson
approved these changes
May 20, 2026
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.
Implements two suggestions from mafredri's review on #485 that have not been picked up yet:
url.Parse+ the SCP-like guard inResolveSubmoduleURLwith go-git'stransport.NewEndpoint. SCP-like parent URLs (git@host:path) now resolve correctly, including thegit@host:port:pathform. The documented Support SCP-like parent URLs with relative submodules #492 limitation goes away.scpRelativeSibling,scpRelativeChild,scpMultiLevelUp,scpWithPort, andhttpsMultiLevelUpcases.badParentand thescpParentWithRelativeSubmodule"expectErr" cases are removed becausetransport.NewEndpoint("://bad")parses asfile://and the SCP case no longer errors.Threads addressed:
transport.NewEndpointpatch)scpWithPorttest)Verified locally:
go test ./git/...: passes (all 9TestResolveSubmoduleURLsubtests pass).go build ./...: clean.golangci-lint run ./git/...: clean.Implementation plan
Out of scope (intentional):
SameHostis unit-tested already. A higher-level test needs separate host identities for the twohttptest.Servers and that is a real piece of work; @bjornrobertsson is already asking for guidance in-thread.git.Submodules().Update(). Discussed and parked due to known go-git v5 relative-path bugs.