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

Method TestCommitParent

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

Source from the content-addressed store, hash-verified

141}
142
143func (s *WorktreeSuite) TestCommitParent(c *C) {
144 expected := plumbing.NewHash("ef3ca05477530b37f48564be33ddd48063fc7a22")
145
146 fs := memfs.New()
147 w := &Worktree{
148 r: s.Repository,
149 Filesystem: fs,
150 }
151
152 err := w.Checkout(&CheckoutOptions{})
153 c.Assert(err, IsNil)
154
155 err = util.WriteFile(fs, "foo", []byte("foo"), 0644)
156 c.Assert(err, IsNil)
157
158 _, err = w.Add("foo")
159 c.Assert(err, IsNil)
160
161 hash, err := w.Commit("foo\n", &CommitOptions{Author: defaultSignature()})
162 c.Assert(hash, Equals, expected)
163 c.Assert(err, IsNil)
164
165 assertStorageStatus(c, s.Repository, 13, 11, 10, expected)
166}
167
168func (s *WorktreeSuite) TestCommitAmendWithoutChanges(c *C) {
169 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