| 841 | } |
| 842 | |
| 843 | func (s *WorktreeSuite) TestCheckoutCreateWithHash(c *C) { |
| 844 | w := &Worktree{ |
| 845 | r: s.Repository, |
| 846 | Filesystem: memfs.New(), |
| 847 | } |
| 848 | |
| 849 | err := w.Checkout(&CheckoutOptions{ |
| 850 | Create: true, |
| 851 | Branch: "refs/heads/foo", |
| 852 | Hash: plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9"), |
| 853 | }) |
| 854 | c.Assert(err, IsNil) |
| 855 | |
| 856 | head, err := w.r.Head() |
| 857 | c.Assert(err, IsNil) |
| 858 | c.Assert(head.Name().String(), Equals, "refs/heads/foo") |
| 859 | c.Assert(head.Hash(), Equals, plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9")) |
| 860 | |
| 861 | status, err := w.Status() |
| 862 | c.Assert(err, IsNil) |
| 863 | c.Assert(status.IsClean(), Equals, true) |
| 864 | } |
| 865 | |
| 866 | func (s *WorktreeSuite) TestCheckoutCreate(c *C) { |
| 867 | w := &Worktree{ |