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

Method TestCheckoutBranch

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

Source from the content-addressed store, hash-verified

734}
735
736func (s *WorktreeSuite) TestCheckoutBranch(c *C) {
737 w := &Worktree{
738 r: s.Repository,
739 Filesystem: memfs.New(),
740 }
741
742 err := w.Checkout(&CheckoutOptions{
743 Branch: "refs/heads/branch",
744 })
745 c.Assert(err, IsNil)
746
747 head, err := w.r.Head()
748 c.Assert(err, IsNil)
749 c.Assert(head.Name().String(), Equals, "refs/heads/branch")
750
751 status, err := w.Status()
752 c.Assert(err, IsNil)
753 c.Assert(status.IsClean(), Equals, true)
754}
755
756func (s *WorktreeSuite) TestCheckoutCreateWithHash(c *C) {
757 w := &Worktree{

Callers

nothing calls this directly

Calls 6

CheckoutMethod · 0.95
StatusMethod · 0.95
HeadMethod · 0.80
StringMethod · 0.65
NameMethod · 0.65
IsCleanMethod · 0.45

Tested by

no test coverage detected