From 9488c59834f6a2591910b7b360721cec2c16c548 Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Mon, 24 Jul 2017 10:51:01 +0200 Subject: config: multiple values in RemoteConfig (URLs and Fetch) * Change `URL string` to `URL []string` in `RemoteConfig`, since git allows multiple URLs per remote. See: http://marc.info/?l=git&m=116231242118202&w=2 * Fix marshalling of multiple fetch refspecs. --- repository_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'repository_test.go') diff --git a/repository_test.go b/repository_test.go index 558149b..00ce120 100644 --- a/repository_test.go +++ b/repository_test.go @@ -181,7 +181,7 @@ func (s *RepositorySuite) TestCreateRemoteAndRemote(c *C) { r, _ := Init(memory.NewStorage(), nil) remote, err := r.CreateRemote(&config.RemoteConfig{ Name: "foo", - URL: "http://foo/foo.git", + URLs: []string{"http://foo/foo.git"}, }) c.Assert(err, IsNil) @@ -205,7 +205,7 @@ func (s *RepositorySuite) TestDeleteRemote(c *C) { r, _ := Init(memory.NewStorage(), nil) _, err := r.CreateRemote(&config.RemoteConfig{ Name: "foo", - URL: "http://foo/foo.git", + URLs: []string{"http://foo/foo.git"}, }) c.Assert(err, IsNil) @@ -426,7 +426,7 @@ func (s *RepositorySuite) TestFetch(c *C) { r, _ := Init(memory.NewStorage(), nil) _, err := r.CreateRemote(&config.RemoteConfig{ Name: DefaultRemoteName, - URL: s.GetBasicLocalRepositoryURL(), + URLs: []string{s.GetBasicLocalRepositoryURL()}, }) c.Assert(err, IsNil) c.Assert(r.Fetch(&FetchOptions{}), IsNil) @@ -449,7 +449,7 @@ func (s *RepositorySuite) TestFetchContext(c *C) { r, _ := Init(memory.NewStorage(), nil) _, err := r.CreateRemote(&config.RemoteConfig{ Name: DefaultRemoteName, - URL: s.GetBasicLocalRepositoryURL(), + URLs: []string{s.GetBasicLocalRepositoryURL()}, }) c.Assert(err, IsNil) @@ -531,7 +531,7 @@ func (s *RepositorySuite) TestCloneConfig(c *C) { c.Assert(cfg.Core.IsBare, Equals, true) c.Assert(cfg.Remotes, HasLen, 1) c.Assert(cfg.Remotes["origin"].Name, Equals, "origin") - c.Assert(cfg.Remotes["origin"].URL, Not(Equals), "") + c.Assert(cfg.Remotes["origin"].URLs, HasLen, 1) } func (s *RepositorySuite) TestCloneSingleBranchAndNonHEAD(c *C) { @@ -629,7 +629,7 @@ func (s *RepositorySuite) TestPush(c *C) { _, err = s.Repository.CreateRemote(&config.RemoteConfig{ Name: "test", - URL: url, + URLs: []string{url}, }) c.Assert(err, IsNil) @@ -657,7 +657,7 @@ func (s *RepositorySuite) TestPushContext(c *C) { _, err = s.Repository.CreateRemote(&config.RemoteConfig{ Name: "foo", - URL: url, + URLs: []string{url}, }) c.Assert(err, IsNil) -- cgit