MCPcopy Index your code
hub / github.com/augmentable-dev/tickgit / SearchCommit

Function SearchCommit

pkg/comments/comments.go:110–147  ·  view source on GitHub ↗

SearchCommit searches all files in the tree of a given commit

(commit *object.Commit, cb func(*Comment))

Source from the content-addressed store, hash-verified

108
109// SearchCommit searches all files in the tree of a given commit
110func SearchCommit(commit *object.Commit, cb func(*Comment)) error {
111 var wg sync.WaitGroup
112 errs := make(chan error)
113
114 fileIter, err := commit.Files()
115 if err != nil {
116 return err
117 }
118 defer fileIter.Close()
119 err = fileIter.ForEach(func(file *object.File) error {
120 if file.Mode.IsFile() {
121 wg.Add(1)
122 go func() {
123 defer wg.Done()
124
125 r, err := file.Reader()
126 if err != nil {
127 errs <- err
128 return
129 }
130 err = SearchFile(file.Name, r, cb)
131 if err != nil {
132 errs <- err
133 return
134 }
135
136 }()
137 }
138 return nil
139 })
140
141 if err != nil {
142 return err
143 }
144
145 wg.Wait()
146 return nil
147}

Callers

nothing calls this directly

Calls 1

SearchFileFunction · 0.85

Tested by

no test coverage detected