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

Method TestRemoveAndCommitAll

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

Source from the content-addressed store, hash-verified

303}
304
305func (s *WorktreeSuite) TestRemoveAndCommitAll(c *C) {
306 expected := plumbing.NewHash("907cd576c6ced2ecd3dab34a72bf9cf65944b9a9")
307
308 fs := memfs.New()
309 w := &Worktree{
310 r: s.Repository,
311 Filesystem: fs,
312 }
313
314 err := w.Checkout(&CheckoutOptions{})
315 c.Assert(err, IsNil)
316
317 util.WriteFile(fs, "foo", []byte("foo"), 0644)
318 _, err = w.Add("foo")
319 c.Assert(err, IsNil)
320
321 _, errFirst := w.Commit("Add in Repo\n", &CommitOptions{
322 Author: defaultSignature(),
323 })
324 c.Assert(errFirst, IsNil)
325
326 errRemove := fs.Remove("foo")
327 c.Assert(errRemove, IsNil)
328
329 hash, errSecond := w.Commit("Remove foo\n", &CommitOptions{
330 All: true,
331 Author: defaultSignature(),
332 })
333 c.Assert(errSecond, IsNil)
334
335 c.Assert(hash, Equals, expected)
336 c.Assert(err, IsNil)
337
338 assertStorageStatus(c, s.Repository, 13, 11, 11, expected)
339}
340
341func (s *WorktreeSuite) TestCommitSign(c *C) {
342 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