| 864 | } |
| 865 | |
| 866 | func (s *WorktreeSuite) TestCheckoutCreate(c *C) { |
| 867 | w := &Worktree{ |
| 868 | r: s.Repository, |
| 869 | Filesystem: memfs.New(), |
| 870 | } |
| 871 | |
| 872 | err := w.Checkout(&CheckoutOptions{ |
| 873 | Create: true, |
| 874 | Branch: "refs/heads/foo", |
| 875 | }) |
| 876 | c.Assert(err, IsNil) |
| 877 | |
| 878 | head, err := w.r.Head() |
| 879 | c.Assert(err, IsNil) |
| 880 | c.Assert(head.Name().String(), Equals, "refs/heads/foo") |
| 881 | c.Assert(head.Hash(), Equals, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")) |
| 882 | |
| 883 | status, err := w.Status() |
| 884 | c.Assert(err, IsNil) |
| 885 | c.Assert(status.IsClean(), Equals, true) |
| 886 | } |
| 887 | |
| 888 | func (s *WorktreeSuite) TestCheckoutBranchAndHash(c *C) { |
| 889 | w := &Worktree{ |