fork of go-git with some jj specific features
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

+93 -61
+1 -1
_examples/remotes/main.go
··· 27 27 Info("git remote add example https://github.com/git-fixtures/basic.git") 28 28 _, err = r.CreateRemote(&config.RemoteConfig{ 29 29 Name: "example", 30 - URL: "https://github.com/git-fixtures/basic.git", 30 + URLs: []string{"https://github.com/git-fixtures/basic.git"}, 31 31 }) 32 32 33 33 CheckIfError(err)
+17 -6
config/config.go
··· 187 187 type RemoteConfig struct { 188 188 // Name of the remote 189 189 Name string 190 - // URL the URL of a remote repository 191 - URL string 190 + // URLs the URLs of a remote repository. It must be non-empty. Fetch will 191 + // always use the first URL, while push will use all of them. 192 + URLs []string 192 193 // Fetch the default set of "refspec" for fetch operation 193 194 Fetch []RefSpec 194 195 ··· 203 204 return ErrRemoteConfigEmptyName 204 205 } 205 206 206 - if c.URL == "" { 207 + if len(c.URLs) == 0 { 207 208 return ErrRemoteConfigEmptyURL 208 209 } 209 210 ··· 231 232 } 232 233 233 234 fetch = append(fetch, rs) 235 + } 236 + 237 + var urls []string 238 + for _, f := range c.raw.Options.GetAll(urlKey) { 239 + urls = append(urls, f) 234 240 } 235 241 236 242 c.Name = c.raw.Name 237 - c.URL = c.raw.Option(urlKey) 243 + c.URLs = urls 238 244 c.Fetch = fetch 239 245 240 246 return nil ··· 246 252 } 247 253 248 254 c.raw.Name = c.Name 249 - c.raw.SetOption(urlKey, c.URL) 255 + c.raw.RemoveOption(urlKey) 256 + for _, url := range c.URLs { 257 + c.raw.AddOption(urlKey, url) 258 + } 259 + 260 + c.raw.RemoveOption(fetchKey) 250 261 for _, rs := range c.Fetch { 251 - c.raw.SetOption(fetchKey, rs.String()) 262 + c.raw.AddOption(fetchKey, rs.String()) 252 263 } 253 264 254 265 return c.raw
+23 -4
config/config_test.go
··· 13 13 [remote "origin"] 14 14 url = git@github.com:mcuadros/go-git.git 15 15 fetch = +refs/heads/*:refs/remotes/origin/* 16 + [remote "alt"] 17 + url = git@github.com:mcuadros/go-git.git 18 + url = git@github.com:src-d/go-git.git 19 + fetch = +refs/heads/*:refs/remotes/origin/* 20 + fetch = +refs/pull/*:refs/remotes/origin/pull/* 16 21 [submodule "qux"] 17 22 path = qux 18 23 url = https://github.com/foo/qux.git ··· 28 33 29 34 c.Assert(cfg.Core.IsBare, Equals, true) 30 35 c.Assert(cfg.Core.Worktree, Equals, "foo") 31 - c.Assert(cfg.Remotes, HasLen, 1) 36 + c.Assert(cfg.Remotes, HasLen, 2) 32 37 c.Assert(cfg.Remotes["origin"].Name, Equals, "origin") 33 - c.Assert(cfg.Remotes["origin"].URL, Equals, "git@github.com:mcuadros/go-git.git") 38 + c.Assert(cfg.Remotes["origin"].URLs, DeepEquals, []string{"git@github.com:mcuadros/go-git.git"}) 34 39 c.Assert(cfg.Remotes["origin"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*"}) 40 + c.Assert(cfg.Remotes["alt"].Name, Equals, "alt") 41 + c.Assert(cfg.Remotes["alt"].URLs, DeepEquals, []string{"git@github.com:mcuadros/go-git.git", "git@github.com:src-d/go-git.git"}) 42 + c.Assert(cfg.Remotes["alt"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/remotes/origin/pull/*"}) 35 43 c.Assert(cfg.Submodules, HasLen, 1) 36 44 c.Assert(cfg.Submodules["qux"].Name, Equals, "qux") 37 45 c.Assert(cfg.Submodules["qux"].URL, Equals, "https://github.com/foo/qux.git") ··· 45 53 worktree = bar 46 54 [remote "origin"] 47 55 url = git@github.com:mcuadros/go-git.git 56 + [remote "alt"] 57 + url = git@github.com:mcuadros/go-git.git 58 + url = git@github.com:src-d/go-git.git 59 + fetch = +refs/heads/*:refs/remotes/origin/* 60 + fetch = +refs/pull/*:refs/remotes/origin/pull/* 48 61 [submodule "qux"] 49 62 url = https://github.com/foo/qux.git 50 63 `) ··· 54 67 cfg.Core.Worktree = "bar" 55 68 cfg.Remotes["origin"] = &RemoteConfig{ 56 69 Name: "origin", 57 - URL: "git@github.com:mcuadros/go-git.git", 70 + URLs: []string{"git@github.com:mcuadros/go-git.git"}, 71 + } 72 + 73 + cfg.Remotes["alt"] = &RemoteConfig{ 74 + Name: "alt", 75 + URLs: []string{"git@github.com:mcuadros/go-git.git", "git@github.com:src-d/go-git.git"}, 76 + Fetch: []RefSpec{"+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/remotes/origin/pull/*"}, 58 77 } 59 78 60 79 cfg.Submodules["qux"] = &Submodule{ ··· 122 141 } 123 142 124 143 func (s *ConfigSuite) TestRemoteConfigValidateDefault(c *C) { 125 - config := &RemoteConfig{Name: "foo", URL: "http://foo/bar"} 144 + config := &RemoteConfig{Name: "foo", URLs: []string{"http://foo/bar"}} 126 145 c.Assert(config.Validate(), IsNil) 127 146 128 147 fetch := config.Fetch
+1 -1
example_test.go
··· 91 91 // Add a new remote, with the default fetch refspec 92 92 _, err := r.CreateRemote(&config.RemoteConfig{ 93 93 Name: "example", 94 - URL: "https://github.com/git-fixtures/basic.git", 94 + URLs: []string{"https://github.com/git-fixtures/basic.git"}, 95 95 }) 96 96 97 97 if err != nil {
+7 -4
remote.go
··· 43 43 } 44 44 45 45 func (r *Remote) String() string { 46 - fetch := r.c.URL 47 - push := r.c.URL 46 + var fetch, push string 47 + if len(r.c.URLs) > 0 { 48 + fetch = r.c.URLs[0] 49 + push = r.c.URLs[0] 50 + } 48 51 49 52 return fmt.Sprintf("%s\t%s (fetch)\n%[1]s\t%[3]s (push)", r.c.Name, fetch, push) 50 53 } ··· 71 74 return fmt.Errorf("remote names don't match: %s != %s", o.RemoteName, r.c.Name) 72 75 } 73 76 74 - s, err := newSendPackSession(r.c.URL, o.Auth) 77 + s, err := newSendPackSession(r.c.URLs[0], o.Auth) 75 78 if err != nil { 76 79 return err 77 80 } ··· 211 214 o.RefSpecs = r.c.Fetch 212 215 } 213 216 214 - s, err := newUploadPackSession(r.c.URL, o.Auth) 217 + s, err := newUploadPackSession(r.c.URLs[0], o.Auth) 215 218 if err != nil { 216 219 return nil, err 217 220 }
+27 -28
remote_test.go
··· 26 26 var _ = Suite(&RemoteSuite{}) 27 27 28 28 func (s *RemoteSuite) TestFetchInvalidEndpoint(c *C) { 29 - r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: "http://\\"}) 29 + r := newRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"http://\\"}}) 30 30 err := r.Fetch(&FetchOptions{RemoteName: "foo"}) 31 31 c.Assert(err, ErrorMatches, ".*invalid character.*") 32 32 } 33 33 34 34 func (s *RemoteSuite) TestFetchNonExistentEndpoint(c *C) { 35 - r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: "ssh://non-existent/foo.git"}) 35 + r := newRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"ssh://non-existent/foo.git"}}) 36 36 err := r.Fetch(&FetchOptions{}) 37 37 c.Assert(err, NotNil) 38 38 } 39 39 40 40 func (s *RemoteSuite) TestFetchInvalidSchemaEndpoint(c *C) { 41 - r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: "qux://foo"}) 41 + r := newRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"qux://foo"}}) 42 42 err := r.Fetch(&FetchOptions{}) 43 43 c.Assert(err, ErrorMatches, ".*unsupported scheme.*") 44 44 } 45 45 46 46 func (s *RemoteSuite) TestFetchInvalidFetchOptions(c *C) { 47 - r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: "qux://foo"}) 47 + r := newRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"qux://foo"}}) 48 48 invalid := config.RefSpec("^*$ñ") 49 49 err := r.Fetch(&FetchOptions{RefSpecs: []config.RefSpec{invalid}}) 50 50 c.Assert(err, Equals, config.ErrRefSpecMalformedSeparator) ··· 52 52 53 53 func (s *RemoteSuite) TestFetchWildcard(c *C) { 54 54 r := newRemote(memory.NewStorage(), &config.RemoteConfig{ 55 - URL: s.GetBasicLocalRepositoryURL(), 55 + URLs: []string{s.GetBasicLocalRepositoryURL()}, 56 56 }) 57 57 58 58 s.testFetch(c, r, &FetchOptions{ ··· 68 68 69 69 func (s *RemoteSuite) TestFetchWildcardTags(c *C) { 70 70 r := newRemote(memory.NewStorage(), &config.RemoteConfig{ 71 - URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()), 71 + URLs: []string{s.GetLocalRepositoryURL(fixtures.ByTag("tags").One())}, 72 72 }) 73 73 74 74 s.testFetch(c, r, &FetchOptions{ ··· 87 87 88 88 func (s *RemoteSuite) TestFetch(c *C) { 89 89 r := newRemote(memory.NewStorage(), &config.RemoteConfig{ 90 - URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()), 90 + URLs: []string{s.GetLocalRepositoryURL(fixtures.ByTag("tags").One())}, 91 91 }) 92 92 93 93 s.testFetch(c, r, &FetchOptions{ ··· 101 101 102 102 func (s *RemoteSuite) TestFetchContext(c *C) { 103 103 r := newRemote(memory.NewStorage(), &config.RemoteConfig{ 104 - URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()), 104 + URLs: []string{s.GetLocalRepositoryURL(fixtures.ByTag("tags").One())}, 105 105 }) 106 106 107 107 ctx, cancel := context.WithCancel(context.Background()) ··· 113 113 }, 114 114 }) 115 115 c.Assert(err, NotNil) 116 - 117 116 } 118 117 119 118 func (s *RemoteSuite) TestFetchWithAllTags(c *C) { 120 119 r := newRemote(memory.NewStorage(), &config.RemoteConfig{ 121 - URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()), 120 + URLs: []string{s.GetLocalRepositoryURL(fixtures.ByTag("tags").One())}, 122 121 }) 123 122 124 123 s.testFetch(c, r, &FetchOptions{ ··· 138 137 139 138 func (s *RemoteSuite) TestFetchWithNoTags(c *C) { 140 139 r := newRemote(memory.NewStorage(), &config.RemoteConfig{ 141 - URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()), 140 + URLs: []string{s.GetLocalRepositoryURL(fixtures.ByTag("tags").One())}, 142 141 }) 143 142 144 143 s.testFetch(c, r, &FetchOptions{ ··· 154 153 155 154 func (s *RemoteSuite) TestFetchWithDepth(c *C) { 156 155 r := newRemote(memory.NewStorage(), &config.RemoteConfig{ 157 - URL: s.GetBasicLocalRepositoryURL(), 156 + URLs: []string{s.GetBasicLocalRepositoryURL()}, 158 157 }) 159 158 160 159 s.testFetch(c, r, &FetchOptions{ ··· 193 192 sto := memory.NewStorage() 194 193 buf := bytes.NewBuffer(nil) 195 194 196 - r := newRemote(sto, &config.RemoteConfig{Name: "foo", URL: url}) 195 + r := newRemote(sto, &config.RemoteConfig{Name: "foo", URLs: []string{url}}) 197 196 198 197 refspec := config.RefSpec("+refs/heads/*:refs/remotes/origin/*") 199 198 err := r.Fetch(&FetchOptions{ ··· 229 228 mock := &mockPackfileWriter{Storer: fss} 230 229 231 230 url := s.GetBasicLocalRepositoryURL() 232 - r := newRemote(mock, &config.RemoteConfig{Name: "foo", URL: url}) 231 + r := newRemote(mock, &config.RemoteConfig{Name: "foo", URLs: []string{url}}) 233 232 234 233 refspec := config.RefSpec("+refs/heads/*:refs/remotes/origin/*") 235 234 err = r.Fetch(&FetchOptions{ ··· 258 257 259 258 func (s *RemoteSuite) TestFetchNoErrAlreadyUpToDateButStillUpdateLocalRemoteRefs(c *C) { 260 259 r := newRemote(memory.NewStorage(), &config.RemoteConfig{ 261 - URL: s.GetBasicLocalRepositoryURL(), 260 + URLs: []string{s.GetBasicLocalRepositoryURL()}, 262 261 }) 263 262 264 263 o := &FetchOptions{ ··· 294 293 } 295 294 296 295 func (s *RemoteSuite) doTestFetchNoErrAlreadyUpToDate(c *C, url string) { 297 - r := newRemote(memory.NewStorage(), &config.RemoteConfig{URL: url}) 296 + r := newRemote(memory.NewStorage(), &config.RemoteConfig{URLs: []string{url}}) 298 297 299 298 o := &FetchOptions{ 300 299 RefSpecs: []config.RefSpec{ ··· 311 310 func (s *RemoteSuite) TestString(c *C) { 312 311 r := newRemote(nil, &config.RemoteConfig{ 313 312 Name: "foo", 314 - URL: "https://github.com/git-fixtures/basic.git", 313 + URLs: []string{"https://github.com/git-fixtures/basic.git"}, 315 314 }) 316 315 317 316 c.Assert(r.String(), Equals, ""+ ··· 331 330 332 331 r := newRemote(sto, &config.RemoteConfig{ 333 332 Name: DefaultRemoteName, 334 - URL: url, 333 + URLs: []string{url}, 335 334 }) 336 335 337 336 rs := config.RefSpec("refs/heads/*:refs/heads/*") ··· 369 368 370 369 r := newRemote(sto, &config.RemoteConfig{ 371 370 Name: DefaultRemoteName, 372 - URL: url, 371 + URLs: []string{url}, 373 372 }) 374 373 375 374 ctx, cancel := context.WithCancel(context.Background()) ··· 392 391 393 392 r := newRemote(sto, &config.RemoteConfig{ 394 393 Name: DefaultRemoteName, 395 - URL: url, 394 + URLs: []string{url}, 396 395 }) 397 396 398 397 err = r.Push(&PushOptions{ ··· 416 415 417 416 r := newRemote(sto, &config.RemoteConfig{ 418 417 Name: DefaultRemoteName, 419 - URL: fs.Root(), 418 + URLs: []string{fs.Root()}, 420 419 }) 421 420 422 421 err = r.Push(&PushOptions{ ··· 490 489 url := dstFs.Root() 491 490 r := newRemote(sto, &config.RemoteConfig{ 492 491 Name: DefaultRemoteName, 493 - URL: url, 492 + URLs: []string{url}, 494 493 }) 495 494 496 495 oldRef, err := dstSto.Reference(plumbing.ReferenceName("refs/heads/branch")) ··· 540 539 } 541 540 542 541 func (s *RemoteSuite) TestPushInvalidEndpoint(c *C) { 543 - r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: "http://\\"}) 542 + r := newRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"http://\\"}}) 544 543 err := r.Push(&PushOptions{RemoteName: "foo"}) 545 544 c.Assert(err, ErrorMatches, ".*invalid character.*") 546 545 } 547 546 548 547 func (s *RemoteSuite) TestPushNonExistentEndpoint(c *C) { 549 - r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: "ssh://non-existent/foo.git"}) 548 + r := newRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"ssh://non-existent/foo.git"}}) 550 549 err := r.Push(&PushOptions{}) 551 550 c.Assert(err, NotNil) 552 551 } 553 552 554 553 func (s *RemoteSuite) TestPushInvalidSchemaEndpoint(c *C) { 555 - r := newRemote(nil, &config.RemoteConfig{Name: "origin", URL: "qux://foo"}) 554 + r := newRemote(nil, &config.RemoteConfig{Name: "origin", URLs: []string{"qux://foo"}}) 556 555 err := r.Push(&PushOptions{}) 557 556 c.Assert(err, ErrorMatches, ".*unsupported scheme.*") 558 557 } 559 558 560 559 func (s *RemoteSuite) TestPushInvalidFetchOptions(c *C) { 561 - r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: "qux://foo"}) 560 + r := newRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"qux://foo"}}) 562 561 invalid := config.RefSpec("^*$ñ") 563 562 err := r.Push(&PushOptions{RefSpecs: []config.RefSpec{invalid}}) 564 563 c.Assert(err, Equals, config.ErrRefSpecMalformedSeparator) ··· 567 566 func (s *RemoteSuite) TestPushInvalidRefSpec(c *C) { 568 567 r := newRemote(nil, &config.RemoteConfig{ 569 568 Name: DefaultRemoteName, 570 - URL: "some-url", 569 + URLs: []string{"some-url"}, 571 570 }) 572 571 573 572 rs := config.RefSpec("^*$**") ··· 580 579 func (s *RemoteSuite) TestPushWrongRemoteName(c *C) { 581 580 r := newRemote(nil, &config.RemoteConfig{ 582 581 Name: DefaultRemoteName, 583 - URL: "some-url", 582 + URLs: []string{"some-url"}, 584 583 }) 585 584 586 585 err := r.Push(&PushOptions{
+1 -1
repository.go
··· 408 408 409 409 c := &config.RemoteConfig{ 410 410 Name: o.RemoteName, 411 - URL: o.URL, 411 + URLs: []string{o.URL}, 412 412 } 413 413 414 414 if _, err := r.CreateRemote(c); err != nil {
+7 -7
repository_test.go
··· 181 181 r, _ := Init(memory.NewStorage(), nil) 182 182 remote, err := r.CreateRemote(&config.RemoteConfig{ 183 183 Name: "foo", 184 - URL: "http://foo/foo.git", 184 + URLs: []string{"http://foo/foo.git"}, 185 185 }) 186 186 187 187 c.Assert(err, IsNil) ··· 205 205 r, _ := Init(memory.NewStorage(), nil) 206 206 _, err := r.CreateRemote(&config.RemoteConfig{ 207 207 Name: "foo", 208 - URL: "http://foo/foo.git", 208 + URLs: []string{"http://foo/foo.git"}, 209 209 }) 210 210 211 211 c.Assert(err, IsNil) ··· 426 426 r, _ := Init(memory.NewStorage(), nil) 427 427 _, err := r.CreateRemote(&config.RemoteConfig{ 428 428 Name: DefaultRemoteName, 429 - URL: s.GetBasicLocalRepositoryURL(), 429 + URLs: []string{s.GetBasicLocalRepositoryURL()}, 430 430 }) 431 431 c.Assert(err, IsNil) 432 432 c.Assert(r.Fetch(&FetchOptions{}), IsNil) ··· 449 449 r, _ := Init(memory.NewStorage(), nil) 450 450 _, err := r.CreateRemote(&config.RemoteConfig{ 451 451 Name: DefaultRemoteName, 452 - URL: s.GetBasicLocalRepositoryURL(), 452 + URLs: []string{s.GetBasicLocalRepositoryURL()}, 453 453 }) 454 454 c.Assert(err, IsNil) 455 455 ··· 531 531 c.Assert(cfg.Core.IsBare, Equals, true) 532 532 c.Assert(cfg.Remotes, HasLen, 1) 533 533 c.Assert(cfg.Remotes["origin"].Name, Equals, "origin") 534 - c.Assert(cfg.Remotes["origin"].URL, Not(Equals), "") 534 + c.Assert(cfg.Remotes["origin"].URLs, HasLen, 1) 535 535 } 536 536 537 537 func (s *RepositorySuite) TestCloneSingleBranchAndNonHEAD(c *C) { ··· 629 629 630 630 _, err = s.Repository.CreateRemote(&config.RemoteConfig{ 631 631 Name: "test", 632 - URL: url, 632 + URLs: []string{url}, 633 633 }) 634 634 c.Assert(err, IsNil) 635 635 ··· 657 657 658 658 _, err = s.Repository.CreateRemote(&config.RemoteConfig{ 659 659 Name: "foo", 660 - URL: url, 660 + URLs: []string{url}, 661 661 }) 662 662 c.Assert(err, IsNil) 663 663
+3 -3
storage/filesystem/config_test.go
··· 5 5 "os" 6 6 7 7 "github.com/src-d/go-git-fixtures" 8 + "gopkg.in/src-d/go-git.v4/config" 8 9 "gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit" 9 10 10 11 . "gopkg.in/check.v1" ··· 39 40 c.Assert(remotes, HasLen, 1) 40 41 remote := remotes["origin"] 41 42 c.Assert(remote.Name, Equals, "origin") 42 - c.Assert(remote.URL, Equals, "https://github.com/git-fixtures/basic") 43 - c.Assert(remote.Fetch, HasLen, 1) 44 - c.Assert(remote.Fetch[0].String(), Equals, "+refs/heads/*:refs/remotes/origin/*") 43 + c.Assert(remote.URLs, DeepEquals, []string{"https://github.com/git-fixtures/basic"}) 44 + c.Assert(remote.Fetch, DeepEquals, []config.RefSpec{config.RefSpec("+refs/heads/*:refs/remotes/origin/*")}) 45 45 } 46 46 47 47 func (s *ConfigSuite) TearDownTest(c *C) {
+1 -1
storage/test/storage_suite.go
··· 351 351 expected.Core.IsBare = true 352 352 expected.Remotes["foo"] = &config.RemoteConfig{ 353 353 Name: "foo", 354 - URL: "http://foo/bar.git", 354 + URLs: []string{"http://foo/bar.git"}, 355 355 } 356 356 357 357 err := s.Storer.SetConfig(expected)
+1 -1
submodule.go
··· 130 130 131 131 _, err = r.CreateRemote(&config.RemoteConfig{ 132 132 Name: DefaultRemoteName, 133 - URL: s.c.URL, 133 + URLs: []string{s.c.URL}, 134 134 }) 135 135 136 136 return r, err
+4 -4
worktree_test.go
··· 37 37 r, _ := Init(memory.NewStorage(), fs) 38 38 r.CreateRemote(&config.RemoteConfig{ 39 39 Name: DefaultRemoteName, 40 - URL: s.GetBasicLocalRepositoryURL(), 40 + URLs: []string{s.GetBasicLocalRepositoryURL()}, 41 41 }) 42 42 43 43 w, err := r.Worktree() ··· 115 115 r, _ := Init(memory.NewStorage(), memfs.New()) 116 116 r.CreateRemote(&config.RemoteConfig{ 117 117 Name: DefaultRemoteName, 118 - URL: s.GetBasicLocalRepositoryURL(), 118 + URLs: []string{s.GetBasicLocalRepositoryURL()}, 119 119 }) 120 120 121 121 err := r.Fetch(&FetchOptions{}) ··· 173 173 174 174 r.CreateRemote(&config.RemoteConfig{ 175 175 Name: DefaultRemoteName, 176 - URL: s.GetBasicLocalRepositoryURL(), 176 + URLs: []string{s.GetBasicLocalRepositoryURL()}, 177 177 }) 178 178 179 179 w, err := r.Worktree() ··· 198 198 r, _ := PlainInit(dir, false) 199 199 r.CreateRemote(&config.RemoteConfig{ 200 200 Name: DefaultRemoteName, 201 - URL: path, 201 + URLs: []string{path}, 202 202 }) 203 203 204 204 w, err := r.Worktree()