aboutsummaryrefslogtreecommitdiff
path: root/format/packfile/ingest/fill.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-30 14:28:13 +0000
committerGravatar Runxi Yu2026-03-30 14:28:13 +0000
commita4eeb727468a178a4de0dfc718828f26740484ac (patch)
tree4318d38d49facc80e2e2186f5919fa656be3b31f /format/packfile/ingest/fill.go
parentobject/store/packed: Make store own root, algo, opts (diff)
signatureNo signature
object,store/packed{,/internal/ingest}: Move from format/packfile/ingest
Diffstat (limited to 'format/packfile/ingest/fill.go')
-rw-r--r--format/packfile/ingest/fill.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/format/packfile/ingest/fill.go b/format/packfile/ingest/fill.go
deleted file mode 100644
index eca4e4d6..00000000
--- a/format/packfile/ingest/fill.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package ingest
-
-import (
- "errors"
- "fmt"
- "io"
-)
-
-// fill ensures at least min unread bytes are available in receiver's buffer.
-func (scanner *streamScanner) fill(minLen int) error {
- if minLen <= 0 {
- return nil
- }
-
- if minLen > len(scanner.buf) {
- return fmt.Errorf("packfile/ingest: fill(%d) exceeds scanner buffer", minLen)
- }
-
- for scanner.n-scanner.off < minLen {
- err := scanner.flushConsumedPrefix()
- if err != nil {
- return err
- }
-
- readN, err := scanner.src.Read(scanner.buf[scanner.n:])
- if readN > 0 {
- scanner.n += readN
- }
-
- if err != nil {
- if errors.Is(err, io.EOF) && scanner.n-scanner.off >= minLen {
- return nil
- }
-
- return err
- }
-
- if readN == 0 {
- return io.ErrNoProgress
- }
- }
-
- return nil
-}