| 777 | } |
| 778 | |
| 779 | func (s *WorktreeSuite) TestCheckoutCreate(c *C) { |
| 780 | w := &Worktree{ |
| 781 | r: s.Repository, |
| 782 | Filesystem: memfs.New(), |
| 783 | } |
| 784 | |
| 785 | err := w.Checkout(&CheckoutOptions{ |
| 786 | Create: true, |
| 787 | Branch: "refs/heads/foo", |
| 788 | }) |
| 789 | c.Assert(err, IsNil) |
| 790 | |
| 791 | head, err := w.r.Head() |
| 792 | c.Assert(err, IsNil) |
| 793 | c.Assert(head.Name().String(), Equals, "refs/heads/foo") |
| 794 | c.Assert(head.Hash(), Equals, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")) |
| 795 | |
| 796 | status, err := w.Status() |
| 797 | c.Assert(err, IsNil) |
| 798 | c.Assert(status.IsClean(), Equals, true) |
| 799 | } |
| 800 | |
| 801 | func (s *WorktreeSuite) TestCheckoutBranchAndHash(c *C) { |
| 802 | w := &Worktree{ |