TestCheckoutBisect simulates a git bisect going through the git history and checking every commit over the previous commit
(c *C, url string)
| 936 | // TestCheckoutBisect simulates a git bisect going through the git history and |
| 937 | // checking every commit over the previous commit |
| 938 | func (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 | |
| 960 | func (s *WorktreeSuite) TestStatus(c *C) { |
| 961 | fs := memfs.New() |