* fix(dolt): adopt git origin on first push bd dolt push now wires an existing git origin when no Dolt remote is configured, while init without origin stays local and doctor shows the concrete adoption command. This keeps refs/dolt/data sync discoverable without treating plain remotes as existing Dolt history.\n\n_kilocode-openai/gpt-5.5- on behalf of maphew_ * fix(dolt): address origin adoption review nits Share Dolt remote URL normalization between the push adoption path and doctor guidance, fail before mutating Dolt state when no beads workspace is selected, and cover CheckRemoteConsistency's adoption detail. _codex-gpt-5-medium on behalf of maphew_
40 lines
1.6 KiB
Go
40 lines
1.6 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeRemoteURL(t *testing.T) {
|
|
tests := []struct {
|
|
input string
|
|
want string
|
|
}{
|
|
// Dolt-native schemes — returned as-is
|
|
{"dolthub://myorg/beads", "dolthub://myorg/beads"},
|
|
{"file:///tmp/doltdb", "file:///tmp/doltdb"},
|
|
{"aws://[dolt-table:us-east-1]/mydb", "aws://[dolt-table:us-east-1]/mydb"},
|
|
{"gs://my-bucket/mydb", "gs://my-bucket/mydb"},
|
|
{"git+https://github.com/org/repo.git", "git+https://github.com/org/repo.git"},
|
|
{"git+ssh://git@github.com/org/repo.git", "git+ssh://git@github.com/org/repo.git"},
|
|
{"git+http://example.com/repo.git", "git+http://example.com/repo.git"},
|
|
|
|
// Git URLs — converted to dolt remote format
|
|
{"https://github.com/org/repo.git", "git+https://github.com/org/repo.git"},
|
|
{"http://github.com/org/repo.git", "git+http://github.com/org/repo.git"},
|
|
{"ssh://git@github.com/org/repo.git", "git+ssh://git@github.com/org/repo.git"},
|
|
{"git@github.com:org/repo.git", "git+ssh://git@github.com/org/repo.git"},
|
|
{"C:/Users/alice/repos/beads.git", "git+C:/Users/alice/repos/beads.git"},
|
|
{`D:\repos\beads.git`, `git+D:\repos\beads.git`},
|
|
|
|
// Dolt remotesapi URLs — also converted (callers that need
|
|
// pass-through for user-provided URLs should skip normalization)
|
|
{"http://myserver:7007/mydb", "git+http://myserver:7007/mydb"},
|
|
{"https://doltremoteapi.example.com/mydb", "git+https://doltremoteapi.example.com/mydb"},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.input, func(t *testing.T) {
|
|
got := normalizeRemoteURL(tt.input)
|
|
if got != tt.want {
|
|
t.Errorf("normalizeRemoteURL(%q) = %q, want %q", tt.input, got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|