MCPcopy
hub / github.com/git-lfs/git-lfs / drainScanner

Function drainScanner

commands/command_status.go:199–217  ·  view source on GitHub ↗
(cache map[string]struct{}, scanner *lfs.DiffIndexScanner)

Source from the content-addressed store, hash-verified

197}
198
199func drainScanner(cache map[string]struct{}, scanner *lfs.DiffIndexScanner) ([]*lfs.DiffIndexEntry, error) {
200 var to []*lfs.DiffIndexEntry
201
202 for scanner.Scan() {
203 entry := scanner.Entry()
204
205 key := keyFromEntry(entry)
206 if _, seen := cache[key]; !seen {
207 to = append(to, entry)
208
209 cache[key] = struct{}{}
210 }
211 }
212
213 if err := scanner.Err(); err != nil {
214 return nil, err
215 }
216 return to, nil
217}
218
219func keyFromEntry(e *lfs.DiffIndexEntry) string {
220 var name string = e.DstName

Callers 1

scanIndexFunction · 0.85

Calls 4

keyFromEntryFunction · 0.85
ScanMethod · 0.65
ErrMethod · 0.65
EntryMethod · 0.45

Tested by

no test coverage detected