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

Function createCommit

repository_test.go:85–112  ·  view source on GitHub ↗
(c *C, r *Repository)

Source from the content-addressed store, hash-verified

83}
84
85func createCommit(c *C, r *Repository) plumbing.Hash {
86 // Create a commit so there is a HEAD to check
87 wt, err := r.Worktree()
88 c.Assert(err, IsNil)
89
90 rm, err := wt.Filesystem.Create("foo.txt")
91 c.Assert(err, IsNil)
92
93 _, err = rm.Write([]byte("foo text"))
94 c.Assert(err, IsNil)
95
96 _, err = wt.Add("foo.txt")
97 c.Assert(err, IsNil)
98
99 author := object.Signature{
100 Name: "go-git",
101 Email: "go-git@fake.local",
102 When: time.Now(),
103 }
104
105 h, err := wt.Commit("test commit message", &CommitOptions{
106 All: true,
107 Author: &author,
108 Committer: &author,
109 })
110 c.Assert(err, IsNil)
111 return h
112}
113
114func (s *RepositorySuite) TestInitNonStandardDotGit(c *C) {
115 dir, clean := s.TemporalDir()

Callers 5

TestInitMethod · 0.85
TestInitWithOptionsMethod · 0.85
TestMergeFFMethod · 0.85
TestMergeFF_InvalidMethod · 0.85

Calls 5

WorktreeMethod · 0.80
CreateMethod · 0.80
CommitMethod · 0.65
WriteMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected