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

Method testCheckoutBisect

worktree_test.go:938–958  ·  view source on GitHub ↗

TestCheckoutBisect simulates a git bisect going through the git history and checking every commit over the previous commit

(c *C, url string)

Source from the content-addressed store, hash-verified

936// TestCheckoutBisect simulates a git bisect going through the git history and
937// checking every commit over the previous commit
938func (s *WorktreeSuite) testCheckoutBisect(c *C, url string) {
939 f := fixtures.ByURL(url).One()
940 r := s.NewRepositoryWithEmptyWorktree(f)
941
942 w, err := r.Worktree()
943 c.Assert(err, IsNil)
944
945 iter, err := w.r.Log(&LogOptions{})
946 c.Assert(err, IsNil)
947
948 iter.ForEach(func(commit *object.Commit) error {
949 err := w.Checkout(&CheckoutOptions{Hash: commit.Hash})
950 c.Assert(err, IsNil)
951
952 status, err := w.Status()
953 c.Assert(err, IsNil)
954 c.Assert(status.IsClean(), Equals, true)
955
956 return nil
957 })
958}
959
960func (s *WorktreeSuite) TestStatus(c *C) {
961 fs := memfs.New()

Callers 2

TestCheckoutBisectMethod · 0.95

Calls 7

WorktreeMethod · 0.80
LogMethod · 0.80
CheckoutMethod · 0.80
ForEachMethod · 0.65
StatusMethod · 0.45
IsCleanMethod · 0.45

Tested by

no test coverage detected