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

Method TestCommitInitial

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

Source from the content-addressed store, hash-verified

49}
50
51func (s *WorktreeSuite) TestCommitInitial(c *C) {
52 expected := plumbing.NewHash("98c4ac7c29c913f7461eae06e024dc18e80d23a4")
53
54 fs := memfs.New()
55 storage := memory.NewStorage()
56
57 r, err := Init(storage, fs)
58 c.Assert(err, IsNil)
59
60 w, err := r.Worktree()
61 c.Assert(err, IsNil)
62
63 util.WriteFile(fs, "foo", []byte("foo"), 0644)
64
65 _, err = w.Add("foo")
66 c.Assert(err, IsNil)
67
68 hash, err := w.Commit("foo\n", &CommitOptions{Author: defaultSignature()})
69 c.Assert(hash, Equals, expected)
70 c.Assert(err, IsNil)
71
72 assertStorageStatus(c, r, 1, 1, 1, expected)
73}
74
75func (s *WorktreeSuite) TestNothingToCommit(c *C) {
76 expected := plumbing.NewHash("838ea833ce893e8555907e5ef224aa076f5e274a")

Callers

nothing calls this directly

Calls 8

NewHashFunction · 0.92
NewStorageFunction · 0.92
InitFunction · 0.85
defaultSignatureFunction · 0.85
assertStorageStatusFunction · 0.85
WorktreeMethod · 0.80
CommitMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected