(c *C)
| 423 | } |
| 424 | |
| 425 | func (s *WorktreeSuite) TestRemoveAndCommitAll(c *C) { |
| 426 | expected := plumbing.NewHash("907cd576c6ced2ecd3dab34a72bf9cf65944b9a9") |
| 427 | |
| 428 | fs := memfs.New() |
| 429 | w := &Worktree{ |
| 430 | r: s.Repository, |
| 431 | Filesystem: fs, |
| 432 | } |
| 433 | |
| 434 | err := w.Checkout(&CheckoutOptions{}) |
| 435 | c.Assert(err, IsNil) |
| 436 | |
| 437 | util.WriteFile(fs, "foo", []byte("foo"), 0644) |
| 438 | _, err = w.Add("foo") |
| 439 | c.Assert(err, IsNil) |
| 440 | |
| 441 | _, errFirst := w.Commit("Add in Repo\n", &CommitOptions{ |
| 442 | Author: defaultSignature(), |
| 443 | }) |
| 444 | c.Assert(errFirst, IsNil) |
| 445 | |
| 446 | errRemove := fs.Remove("foo") |
| 447 | c.Assert(errRemove, IsNil) |
| 448 | |
| 449 | hash, errSecond := w.Commit("Remove foo\n", &CommitOptions{ |
| 450 | All: true, |
| 451 | Author: defaultSignature(), |
| 452 | }) |
| 453 | c.Assert(errSecond, IsNil) |
| 454 | |
| 455 | c.Assert(hash, Equals, expected) |
| 456 | c.Assert(err, IsNil) |
| 457 | |
| 458 | assertStorageStatus(c, s.Repository, 13, 11, 11, expected) |
| 459 | } |
| 460 | |
| 461 | func (s *WorktreeSuite) TestCommitSign(c *C) { |
| 462 | fs := memfs.New() |
nothing calls this directly
no test coverage detected