| 754 | } |
| 755 | |
| 756 | func (s *WorktreeSuite) TestCheckoutCreateWithHash(c *C) { |
| 757 | w := &Worktree{ |
| 758 | r: s.Repository, |
| 759 | Filesystem: memfs.New(), |
| 760 | } |
| 761 | |
| 762 | err := w.Checkout(&CheckoutOptions{ |
| 763 | Create: true, |
| 764 | Branch: "refs/heads/foo", |
| 765 | Hash: plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9"), |
| 766 | }) |
| 767 | c.Assert(err, IsNil) |
| 768 | |
| 769 | head, err := w.r.Head() |
| 770 | c.Assert(err, IsNil) |
| 771 | c.Assert(head.Name().String(), Equals, "refs/heads/foo") |
| 772 | c.Assert(head.Hash(), Equals, plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9")) |
| 773 | |
| 774 | status, err := w.Status() |
| 775 | c.Assert(err, IsNil) |
| 776 | c.Assert(status.IsClean(), Equals, true) |
| 777 | } |
| 778 | |
| 779 | func (s *WorktreeSuite) TestCheckoutCreate(c *C) { |
| 780 | w := &Worktree{ |