MCPcopy
hub / github.com/go-git/go-git / TestCheckoutCreateWithHash

Method TestCheckoutCreateWithHash

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

Source from the content-addressed store, hash-verified

841}
842
843func (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
866func (s *WorktreeSuite) TestCheckoutCreate(c *C) {
867 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