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

Method TestCommitEmptyOptions

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

Source from the content-addressed store, hash-verified

27)
28
29func (s *WorktreeSuite) TestCommitEmptyOptions(c *C) {
30 fs := memfs.New()
31 r, err := Init(memory.NewStorage(), fs)
32 c.Assert(err, IsNil)
33
34 w, err := r.Worktree()
35 c.Assert(err, IsNil)
36
37 util.WriteFile(fs, "foo", []byte("foo"), 0644)
38
39 _, err = w.Add("foo")
40 c.Assert(err, IsNil)
41
42 hash, err := w.Commit("foo", &CommitOptions{})
43 c.Assert(err, IsNil)
44 c.Assert(hash.IsZero(), Equals, false)
45
46 commit, err := r.CommitObject(hash)
47 c.Assert(err, IsNil)
48 c.Assert(commit.Author.Name, Not(Equals), "")
49}
50
51func (s *WorktreeSuite) TestCommitInitial(c *C) {
52 expected := plumbing.NewHash("98c4ac7c29c913f7461eae06e024dc18e80d23a4")

Callers

nothing calls this directly

Calls 7

NewStorageFunction · 0.92
InitFunction · 0.85
WorktreeMethod · 0.80
CommitObjectMethod · 0.80
CommitMethod · 0.65
IsZeroMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected