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

Method TestCommitParent

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

Source from the content-addressed store, hash-verified

90}
91
92func (s *WorktreeSuite) TestCommitParent(c *C) {
93 expected := plumbing.NewHash("ef3ca05477530b37f48564be33ddd48063fc7a22")
94
95 fs := memfs.New()
96 w := &Worktree{
97 r: s.Repository,
98 Filesystem: fs,
99 }
100
101 err := w.Checkout(&CheckoutOptions{})
102 c.Assert(err, IsNil)
103
104 util.WriteFile(fs, "foo", []byte("foo"), 0644)
105
106 _, err = w.Add("foo")
107 c.Assert(err, IsNil)
108
109 hash, err := w.Commit("foo\n", &CommitOptions{Author: defaultSignature()})
110 c.Assert(hash, Equals, expected)
111 c.Assert(err, IsNil)
112
113 assertStorageStatus(c, s.Repository, 13, 11, 10, expected)
114}
115
116func (s *WorktreeSuite) TestCommitAmend(c *C) {
117 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected