Skip to content
Permalink
Browse files

lfs: detect errors when object scanner fails

Much as in 7dae495 ("lfs: don't close pointer scanner on error",
2018-11-16), don't close the pointer scanner on error when running git
cat-file --batch, either. This ensures we report errors to the user when
we stop scanning and avoids a deadlock.
  • Loading branch information...
bk2204 committed Jan 3, 2019
1 parent 27601bb commit 16857d83d7446e60f8fd4b083ef528d946741b89
Showing with 6 additions and 3 deletions.
  1. +6 −3 lfs/gitscanner_catfilebatch.go
@@ -23,8 +23,9 @@ func runCatFileBatch(pointerCh chan *WrappedPointer, lockableCh chan string, loc
}

go func() {
canScan := true
for r := range revs.Results {
canScan := scanner.Scan(r)
canScan = scanner.Scan(r)

if err := scanner.Err(); err != nil {
errCh <- err
@@ -41,8 +42,10 @@ func runCatFileBatch(pointerCh chan *WrappedPointer, lockableCh chan string, loc
}
}

if err := revs.Wait(); err != nil {
errCh <- err
if canScan {
if err := revs.Wait(); err != nil {
errCh <- err
}
}

if err := scanner.Close(); err != nil {

0 comments on commit 16857d8

Please sign in to comment.
You can’t perform that action at this time.