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

Method TestCommitInitial

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

Source from the content-addressed store, hash-verified

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