diff options
| author | 2026-03-26 09:17:14 +0000 | |
|---|---|---|
| committer | 2026-03-26 09:18:30 +0000 | |
| commit | 3e884f5f3d42cbc4874a04da31dde10314b0cfad (patch) | |
| tree | f5e1e325fd1a2a0801791c054010213214475d80 /packfile/ingest/flush.go | |
| parent | network/receivepack: Rename from receivepack (diff) | |
| signature | No signature | |
format: Move commitgraph and packfile here
Diffstat (limited to 'packfile/ingest/flush.go')
| -rw-r--r-- | packfile/ingest/flush.go | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/packfile/ingest/flush.go b/packfile/ingest/flush.go deleted file mode 100644 index 96753170..00000000 --- a/packfile/ingest/flush.go +++ /dev/null @@ -1,37 +0,0 @@ -package ingest - -import "fmt" - -// flush writes all consumed-but-unflushed bytes to destination pack file. -func (scanner *streamScanner) flush() error { - return scanner.flushConsumedPrefix() -} - -// flushConsumedPrefix writes scanner.buf[:scanner.off] and compacts unread -// bytes to the start of buffer. -func (scanner *streamScanner) flushConsumedPrefix() error { - if scanner.off == 0 { - return nil - } - - written := 0 - for written < scanner.off { - n, err := scanner.dstFile.Write(scanner.buf[written:scanner.off]) - if err != nil { - return &DestinationWriteError{Op: fmt.Sprintf("write pack: %v", err)} - } - - if n == 0 { - return &DestinationWriteError{Op: "write pack: short write"} - } - - written += n - } - - unread := scanner.n - scanner.off - copy(scanner.buf[:unread], scanner.buf[scanner.off:scanner.n]) - scanner.off = 0 - scanner.n = unread - - return nil -} |
