From daeb9127764fc9dd469294f755e277fdfca09a00 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 10 Jun 2026 00:07:56 +0200 Subject: rtree: add support for multiple URLs per remote This requires changing the index format, which I'm using as an opportunity to: - move from YAML to JSON (so I can maybe kill the YAML parser dependency at some point) - move the index file into standard XDG paths --- internal/rtree/get_test.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'internal/rtree/get_test.go') diff --git a/internal/rtree/get_test.go b/internal/rtree/get_test.go index 4d0d8f3..222ad99 100644 --- a/internal/rtree/get_test.go +++ b/internal/rtree/get_test.go @@ -13,14 +13,14 @@ var testIndexWithTwoRepos = Index{ Repos: []*Repo{ { CheckoutPath: "github.com/foo/bar", - Remotes: []Remote{ - {Name: "origin", URL: "https://github.com/foo/bar"}, + Remotes: map[string]Remote{ + "origin": {URLs: []RemoteURL{"https://github.com/foo/bar"}}, }, }, { CheckoutPath: "github.com/git/git", - Remotes: []Remote{ - {Name: "origin", URL: "https://github.com/git/git"}, + Remotes: map[string]Remote{ + "origin": {URLs: []RemoteURL{"https://github.com/git/git"}}, }, }, }, @@ -55,9 +55,9 @@ func TestGetNewRepo(t *testing.T) { Repos: []*Repo{ { CheckoutPath: "github.com/another/repo", - Remotes: []Remote{ + Remotes: map[string]Remote{ //regardless of the remote URL used, we expect the contracted form to be used - {Name: "origin", URL: "https://github.com/another/repo"}, + "origin": {URLs: []RemoteURL{"https://github.com/another/repo"}}, }, }, testIndexWithTwoRepos.Repos[0], @@ -90,9 +90,9 @@ func TestGetNewForkAsRemote(t *testing.T) { testIndexWithTwoRepos.Repos[0], { CheckoutPath: "github.com/git/git", - Remotes: []Remote{ - {Name: "origin", URL: "https://github.com/git/git"}, - {Name: "myfork", URL: "https://example.com/git"}, + Remotes: map[string]Remote{ + "origin": {URLs: []RemoteURL{"https://github.com/git/git"}}, + "myfork": {URLs: []RemoteURL{"https://example.com/git"}}, }, }, }, @@ -116,8 +116,8 @@ func TestGetNewForkAsSeparate(t *testing.T) { Repos: []*Repo{ { CheckoutPath: "example.com/git", - Remotes: []Remote{ - {Name: "origin", URL: "https://example.com/git"}, + Remotes: map[string]Remote{ + "origin": {URLs: []RemoteURL{"https://example.com/git"}}, }, }, testIndexWithTwoRepos.Repos[0], -- cgit v1.3.1