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

Method TestRemoveAndCommitAll

worktree_commit_test.go:425–459  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

423}
424
425func (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
461func (s *WorktreeSuite) TestCommitSign(c *C) {
462 fs := memfs.New()

Callers

nothing calls this directly

Calls 7

CheckoutMethod · 0.95
AddMethod · 0.95
CommitMethod · 0.95
NewHashFunction · 0.92
defaultSignatureFunction · 0.85
assertStorageStatusFunction · 0.85
RemoveMethod · 0.45

Tested by

no test coverage detected