MCPcopy Create free account
hub / github.com/go-git/go-git / TestCommitAll

Method TestCommitAll

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

Source from the content-addressed store, hash-verified

277}
278
279func (s *WorktreeSuite) TestCommitAll(c *C) {
280 expected := plumbing.NewHash("aede6f8c9c1c7ec9ca8d287c64b8ed151276fa28")
281
282 fs := memfs.New()
283 w := &Worktree{
284 r: s.Repository,
285 Filesystem: fs,
286 }
287
288 err := w.Checkout(&CheckoutOptions{})
289 c.Assert(err, IsNil)
290
291 util.WriteFile(fs, "LICENSE", []byte("foo"), 0644)
292 util.WriteFile(fs, "foo", []byte("foo"), 0644)
293
294 hash, err := w.Commit("foo\n", &CommitOptions{
295 All: true,
296 Author: defaultSignature(),
297 })
298
299 c.Assert(hash, Equals, expected)
300 c.Assert(err, IsNil)
301
302 assertStorageStatus(c, s.Repository, 13, 11, 10, expected)
303}
304
305func (s *WorktreeSuite) TestRemoveAndCommitAll(c *C) {
306 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