MCPcopy Create free account
hub / github.com/go-git/go-git / TestCheckoutCreateWithHash

Method TestCheckoutCreateWithHash

worktree_test.go:756–777  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

754}
755
756func (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
779func (s *WorktreeSuite) TestCheckoutCreate(c *C) {
780 w := &Worktree{

Callers

nothing calls this directly

Calls 8

CheckoutMethod · 0.95
StatusMethod · 0.95
NewHashFunction · 0.92
HeadMethod · 0.80
StringMethod · 0.65
NameMethod · 0.65
HashMethod · 0.65
IsCleanMethod · 0.45

Tested by

no test coverage detected