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

Function parseScannerLogOutput

lfs/gitscanner_log.go:137–172  ·  view source on GitHub ↗
(cb GitScannerFoundPointer, direction LogDiffDirection, cmd *subprocess.BufferedCmd, filter *filepathfilter.Filter)

Source from the content-addressed store, hash-verified

135}
136
137func parseScannerLogOutput(cb GitScannerFoundPointer, direction LogDiffDirection, cmd *subprocess.BufferedCmd, filter *filepathfilter.Filter) {
138 ch := make(chan gitscannerResult, chanBufSize)
139
140 cherr := make(chan []byte)
141
142 go func() {
143 stderr, _ := io.ReadAll(cmd.Stderr)
144 cherr <- stderr
145 close(cherr)
146 }()
147
148 go func() {
149 scanner := newLogScanner(direction, cmd.Stdout)
150 scanner.Filter = filter
151 for scanner.Scan() {
152 if p := scanner.Pointer(); p != nil {
153 ch <- gitscannerResult{Pointer: p}
154 }
155 }
156 if err := scanner.Err(); err != nil {
157 io.ReadAll(cmd.Stdout)
158 ch <- gitscannerResult{Err: errors.New(tr.Tr.Get("error while scanning `git log`: %v", err))}
159 }
160 stderr := <-cherr
161 err := cmd.Wait()
162 if err != nil {
163 ch <- gitscannerResult{Err: errors.New(tr.Tr.Get("error in `git log`: %v %v", err, string(stderr)))}
164 }
165 close(ch)
166 }()
167
168 cmd.Stdin.Close()
169 for result := range ch {
170 cb(result.Pointer, result.Err)
171 }
172}
173
174// logPreviousVersions scans history for all previous versions of LFS pointers
175// from 'since' up to (but not including) the final state at ref

Callers 3

scanUnpushedFunction · 0.85
scanStashedFunction · 0.85
logPreviousSHAsFunction · 0.85

Calls 8

NewFunction · 0.92
newLogScannerFunction · 0.85
ScanMethod · 0.65
ErrMethod · 0.65
GetMethod · 0.65
WaitMethod · 0.65
CloseMethod · 0.65
PointerMethod · 0.45

Tested by

no test coverage detected