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

Function TestIndexAddAllCallback

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

Source from the content-addressed store, hash-verified

212}
213
214func TestIndexAddAllCallback(t *testing.T) {
215 t.Parallel()
216 repo := createTestRepo(t)
217 defer cleanupTestRepo(t, repo)
218
219 err := ioutil.WriteFile(repo.Workdir()+"/README", []byte("foo\n"), 0644)
220 checkFatal(t, err)
221
222 idx, err := repo.Index()
223 checkFatal(t, err)
224
225 cbPath := ""
226 err = idx.AddAll([]string{}, IndexAddDefault, func(p, mP string) error {
227 cbPath = p
228 return nil
229 })
230 checkFatal(t, err)
231 if cbPath != "README" {
232 t.Fatalf("%v", cbPath)
233 }
234
235 treeId, err := idx.WriteTreeTo(repo)
236 checkFatal(t, err)
237
238 if treeId.String() != "b7119b11e8ef7a1a5a34d3ac87f5b075228ac81e" {
239 t.Fatalf("%v", treeId.String())
240 }
241}
242
243func TestIndexOpen(t *testing.T) {
244 t.Parallel()

Callers

nothing calls this directly

Calls 8

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
checkFatalFunction · 0.85
WorkdirMethod · 0.80
AddAllMethod · 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…