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

Method TestCommitAll

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

Source from the content-addressed store, hash-verified

397}
398
399func (s *WorktreeSuite) TestCommitAll(c *C) {
400 expected := plumbing.NewHash("aede6f8c9c1c7ec9ca8d287c64b8ed151276fa28")
401
402 fs := memfs.New()
403 w := &Worktree{
404 r: s.Repository,
405 Filesystem: fs,
406 }
407
408 err := w.Checkout(&CheckoutOptions{})
409 c.Assert(err, IsNil)
410
411 util.WriteFile(fs, "LICENSE", []byte("foo"), 0644)
412 util.WriteFile(fs, "foo", []byte("foo"), 0644)
413
414 hash, err := w.Commit("foo\n", &CommitOptions{
415 All: true,
416 Author: defaultSignature(),
417 })
418
419 c.Assert(hash, Equals, expected)
420 c.Assert(err, IsNil)
421
422 assertStorageStatus(c, s.Repository, 13, 11, 10, expected)
423}
424
425func (s *WorktreeSuite) TestRemoveAndCommitAll(c *C) {
426 expected := plumbing.NewHash("907cd576c6ced2ecd3dab34a72bf9cf65944b9a9")

Callers

nothing calls this directly

Calls 5

CheckoutMethod · 0.95
CommitMethod · 0.95
NewHashFunction · 0.92
defaultSignatureFunction · 0.85
assertStorageStatusFunction · 0.85

Tested by

no test coverage detected