(c *C)
| 547 | } |
| 548 | |
| 549 | func (s *RepositorySuite) TestCreateBranchUnmarshal(c *C) { |
| 550 | r, _ := Init(memory.NewStorage(), nil) |
| 551 | |
| 552 | expected := []byte(`[core] |
| 553 | bare = true |
| 554 | [remote "foo"] |
| 555 | url = http://foo/foo.git |
| 556 | fetch = +refs/heads/*:refs/remotes/foo/* |
| 557 | [branch "foo"] |
| 558 | remote = origin |
| 559 | merge = refs/heads/foo |
| 560 | [branch "master"] |
| 561 | remote = origin |
| 562 | merge = refs/heads/master |
| 563 | `) |
| 564 | |
| 565 | _, err := r.CreateRemote(&config.RemoteConfig{ |
| 566 | Name: "foo", |
| 567 | URLs: []string{"http://foo/foo.git"}, |
| 568 | }) |
| 569 | c.Assert(err, IsNil) |
| 570 | testBranch1 := &config.Branch{ |
| 571 | Name: "master", |
| 572 | Remote: "origin", |
| 573 | Merge: "refs/heads/master", |
| 574 | } |
| 575 | testBranch2 := &config.Branch{ |
| 576 | Name: "foo", |
| 577 | Remote: "origin", |
| 578 | Merge: "refs/heads/foo", |
| 579 | } |
| 580 | err = r.CreateBranch(testBranch1) |
| 581 | c.Assert(err, IsNil) |
| 582 | err = r.CreateBranch(testBranch2) |
| 583 | c.Assert(err, IsNil) |
| 584 | |
| 585 | cfg, err := r.Config() |
| 586 | c.Assert(err, IsNil) |
| 587 | marshaled, err := cfg.Marshal() |
| 588 | c.Assert(err, IsNil) |
| 589 | c.Assert(string(expected), Equals, string(marshaled)) |
| 590 | } |
| 591 | |
| 592 | func (s *RepositorySuite) TestBranchInvalid(c *C) { |
| 593 | r, _ := Init(memory.NewStorage(), nil) |
nothing calls this directly
no test coverage detected