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

Method TestCheckoutCreate

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

Source from the content-addressed store, hash-verified

864}
865
866func (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
888func (s *WorktreeSuite) TestCheckoutBranchAndHash(c *C) {
889 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