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

Function TestIndexReadTree

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

Source from the content-addressed store, hash-verified

26}
27
28func TestIndexReadTree(t *testing.T) {
29 t.Parallel()
30 repo := createTestRepo(t)
31 defer cleanupTestRepo(t, repo)
32
33 _, _ = seedTestRepo(t, repo)
34
35 ref, err := repo.Head()
36 checkFatal(t, err)
37
38 obj, err := ref.Peel(ObjectTree)
39 checkFatal(t, err)
40
41 tree, err := obj.AsTree()
42 checkFatal(t, err)
43
44 idx, err := NewIndex()
45 checkFatal(t, err)
46
47 err = idx.ReadTree(tree)
48 checkFatal(t, err)
49
50 id, err := idx.WriteTreeTo(repo)
51 checkFatal(t, err)
52
53 if tree.Id().Cmp(id) != 0 {
54 t.Fatalf("Read and written trees are not the same")
55 }
56}
57
58func TestIndexWriteTreeTo(t *testing.T) {
59 t.Parallel()

Callers

nothing calls this directly

Calls 12

ReadTreeMethod · 0.95
WriteTreeToMethod · 0.95
createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
seedTestRepoFunction · 0.85
checkFatalFunction · 0.85
NewIndexFunction · 0.85
HeadMethod · 0.80
AsTreeMethod · 0.80
PeelMethod · 0.45
CmpMethod · 0.45
IdMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…