MCPcopy Create free account
hub / github.com/libgit2/git2go / appendCommit

Function appendCommit

merge_test.go:125–158  ·  view source on GitHub ↗
(t *testing.T, repo *Repository)

Source from the content-addressed store, hash-verified

123}
124
125func appendCommit(t *testing.T, repo *Repository) (*Oid, *Oid) {
126 loc, err := time.LoadLocation("Europe/Berlin")
127 checkFatal(t, err)
128 sig := &Signature{
129 Name: "Rand Om Hacker",
130 Email: "random@hacker.com",
131 When: time.Date(2013, 03, 06, 14, 30, 0, 0, loc),
132 }
133
134 idx, err := repo.Index()
135 checkFatal(t, err)
136 err = idx.AddByPath("README")
137 checkFatal(t, err)
138 treeId, err := idx.WriteTree()
139 checkFatal(t, err)
140
141 message := "This is another commit\n"
142 tree, err := repo.LookupTree(treeId)
143 checkFatal(t, err)
144
145 ref, err := repo.References.Lookup("HEAD")
146 checkFatal(t, err)
147
148 parent, err := ref.Peel(ObjectCommit)
149 checkFatal(t, err)
150
151 parentCommit, err := parent.AsCommit()
152 checkFatal(t, err)
153
154 commitId, err := repo.CreateCommit("HEAD", sig, sig, message, tree, parentCommit)
155 checkFatal(t, err)
156
157 return commitId, treeId
158}
159
160func TestMergeBase(t *testing.T) {
161 t.Parallel()

Callers 5

TestMergeBaseFunction · 0.85
TestMergeBasesFunction · 0.85
TestMergeBaseManyFunction · 0.85
TestMergeBasesManyFunction · 0.85
TestMergeBaseOctopusFunction · 0.85

Calls 9

checkFatalFunction · 0.85
AddByPathMethod · 0.80
WriteTreeMethod · 0.80
LookupTreeMethod · 0.80
AsCommitMethod · 0.80
CreateCommitMethod · 0.80
IndexMethod · 0.45
LookupMethod · 0.45
PeelMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…