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

Function TestIndexAddFromBuffer

index_test.go:168–190  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

166}
167
168func TestIndexAddFromBuffer(t *testing.T) {
169 t.Parallel()
170 repo := createTestRepo(t)
171 defer cleanupTestRepo(t, repo)
172
173 idx, err := repo.Index()
174 checkFatal(t, err)
175
176 entry := IndexEntry{
177 Path: "README",
178 Mode: FilemodeBlob,
179 }
180
181 err = idx.AddFromBuffer(&entry, []byte("foo\n"))
182 checkFatal(t, err)
183
184 treeId, err := idx.WriteTreeTo(repo)
185 checkFatal(t, err)
186
187 if treeId.String() != "b7119b11e8ef7a1a5a34d3ac87f5b075228ac81e" {
188 t.Fatalf("%v", treeId.String())
189 }
190}
191
192func TestIndexAddAllNoCallback(t *testing.T) {
193 t.Parallel()

Callers

nothing calls this directly

Calls 7

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
checkFatalFunction · 0.85
AddFromBufferMethod · 0.80
WriteTreeToMethod · 0.80
IndexMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…