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

Method TestCheckoutCreate

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

Source from the content-addressed store, hash-verified

777}
778
779func (s *WorktreeSuite) TestCheckoutCreate(c *C) {
780 w := &Worktree{
781 r: s.Repository,
782 Filesystem: memfs.New(),
783 }
784
785 err := w.Checkout(&CheckoutOptions{
786 Create: true,
787 Branch: "refs/heads/foo",
788 })
789 c.Assert(err, IsNil)
790
791 head, err := w.r.Head()
792 c.Assert(err, IsNil)
793 c.Assert(head.Name().String(), Equals, "refs/heads/foo")
794 c.Assert(head.Hash(), Equals, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))
795
796 status, err := w.Status()
797 c.Assert(err, IsNil)
798 c.Assert(status.IsClean(), Equals, true)
799}
800
801func (s *WorktreeSuite) TestCheckoutBranchAndHash(c *C) {
802 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