/{go,integration-tests}: handle scp style git remote urls better#10640
Merged
coffeegoddd merged 4 commits intomainfrom Mar 5, 2026
Merged
/{go,integration-tests}: handle scp style git remote urls better#10640coffeegoddd merged 4 commits intomainfrom
coffeegoddd merged 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves handling of SCP-style Git remotes ([user@]host:path.git) so relative paths don’t get misinterpreted as absolute paths when Dolt normalizes URLs and later invokes git.
Changes:
- Normalize SCP-style relative remotes to
git+ssh://..././path.gitto preserve “relative path” semantics. - Reconstruct SCP-style
host:pathwhen passing such remotes togit(instead ofssh://host/path, which git treats as absolute). - Add/update Bats + Go tests covering the regression and new normalization behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| integration-tests/bats/remotes-git.bats | Adds regression test and a fake git wrapper to record the URL Dolt passes to git remote add. |
| integration-tests/bats/remote-cmd.bats | Updates expected normalized git+ssh output to include /./ marker. |
| go/libraries/doltcore/env/git_remote_url.go | Changes normalization of SCP-style remotes to include /./ for relative paths. |
| go/libraries/doltcore/env/git_remote_url_test.go | Updates / adds unit tests for the revised SCP-style normalization rules. |
| go/libraries/doltcore/dbfactory/git_remote.go | Converts ssh URLs with /./ back into SCP-style when invoking git for remote setup/validation. |
| go/libraries/doltcore/dbfactory/git_remote_test.go | Adds unit tests for the ssh→SCP reconstruction helper. |
Comments suppressed due to low confidence (1)
go/libraries/doltcore/env/git_remote_url.go:90
- This change updates SCP-style normalization to include a
/./marker (e.g.git@host:path.git→git+ssh://..././path.git). There is at least one existing Go unit test that still asserts the old value (e.g.go/cmd/dolt/commands/remote_test.go:159expects no/./), which will fail once this behavior changes. Please update any remaining expectations to the new normalized form (or loosen them to accept both, if backward compatibility is required).
// scp-like ssh: [user@]host:path/repo.git (no scheme, no ://)
if isScpLikeGitRemote(urlArg) {
host, p := splitScpLike(urlArg)
var pathPart string
if strings.HasPrefix(p, "/") {
// Absolute path: git@host:/abs/repo.git → /abs/repo.git
pathPart = p
} else {
// Relative path: git@host:path.git → /./path.git
pathPart = "/./" + p
}
ssh := "git+ssh://" + host + pathPart
u, err := url.Parse(ssh)
if err != nil {
return "", false, err
}
return u.String(), true, nil
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
@coffeegoddd DOLT
|
Contributor
Author
|
@coffeegoddd DOLT
|
Contributor
Author
|
Fixes #10564 |
Contributor
Author
|
@coffeegoddd DOLT
|
Contributor
Author
|
@coffeegoddd DOLT
|
Contributor
Author
|
@coffeegoddd DOLT |
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.
No description provided.