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

Function TestTreeWalk

tree_test.go:70–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestTreeWalk(t *testing.T) {
71 t.Parallel()
72 repo, err := OpenRepository("testdata/TestGitRepository.git")
73 checkFatal(t, err)
74 treeID, err := NewOid("6020a3b8d5d636e549ccbd0c53e2764684bb3125")
75 checkFatal(t, err)
76
77 tree, err := repo.LookupTree(treeID)
78 checkFatal(t, err)
79
80 var callCount int
81 err = tree.Walk(func(name string, entry *TreeEntry) error {
82 callCount++
83
84 return nil
85 })
86 checkFatal(t, err)
87 if callCount != 11 {
88 t.Fatalf("got called %v times, want %v", callCount, 11)
89 }
90}
91
92func TestTreeWalkSkip(t *testing.T) {
93 t.Parallel()

Callers

nothing calls this directly

Calls 5

OpenRepositoryFunction · 0.85
checkFatalFunction · 0.85
NewOidFunction · 0.85
LookupTreeMethod · 0.80
WalkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…