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

Method writeHistory

plumbing/object/commit_stats_test.go:71–96  ·  view source on GitHub ↗
(c *C, files ...[]byte)

Source from the content-addressed store, hash-verified

69}
70
71func (s *CommitStatsSuite) writeHistory(c *C, files ...[]byte) (*git.Repository, plumbing.Hash) {
72 cm := &git.CommitOptions{
73 Author: &object.Signature{Name: "Foo", Email: "foo@example.local", When: time.Now()},
74 }
75
76 fs := memfs.New()
77 r, err := git.Init(memory.NewStorage(), fs)
78 c.Assert(err, IsNil)
79
80 w, err := r.Worktree()
81 c.Assert(err, IsNil)
82
83 var hash plumbing.Hash
84 for _, content := range files {
85 util.WriteFile(fs, "foo", content, 0644)
86
87 _, err = w.Add("foo")
88 c.Assert(err, IsNil)
89
90 hash, err = w.Commit("foo\n", cm)
91 c.Assert(err, IsNil)
92
93 }
94
95 return r, hash
96}

Callers 3

TestStatsMethod · 0.95
TestStats_RootCommitMethod · 0.95

Calls 5

NewStorageFunction · 0.92
WorktreeMethod · 0.80
InitMethod · 0.65
CommitMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected