MCPcopy Index your code
hub / github.com/go-git/go-git / testCheckoutBisect

Method testCheckoutBisect

worktree_test.go:1025–1045  ·  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

1023// TestCheckoutBisect simulates a git bisect going through the git history and
1024// checking every commit over the previous commit
1025func (s *WorktreeSuite) testCheckoutBisect(c *C, url string) {
1026 f := fixtures.ByURL(url).One()
1027 r := s.NewRepositoryWithEmptyWorktree(f)
1028
1029 w, err := r.Worktree()
1030 c.Assert(err, IsNil)
1031
1032 iter, err := w.r.Log(&LogOptions{})
1033 c.Assert(err, IsNil)
1034
1035 iter.ForEach(func(commit *object.Commit) error {
1036 err := w.Checkout(&CheckoutOptions{Hash: commit.Hash})
1037 c.Assert(err, IsNil)
1038
1039 status, err := w.Status()
1040 c.Assert(err, IsNil)
1041 c.Assert(status.IsClean(), Equals, true)
1042
1043 return nil
1044 })
1045}
1046
1047func (s *WorktreeSuite) TestStatus(c *C) {
1048 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