aboutsummaryrefslogtreecommitdiff
path: root/format/pack/ingest/api.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-07 23:35:28 +0800
committerGravatar Runxi Yu2026-03-07 23:35:28 +0800
commitb279c7e4dc798b4c8055af8e974edbc8973d4537 (patch)
tree1710e154f86d391a2f6789e37318fa6363d2beec /format/pack/ingest/api.go
parentinternal/testgit: Add more execution helpers (diff)
signatureNo signature
format/pack/ingest: Use Options; don't require EOF
Diffstat (limited to 'format/pack/ingest/api.go')
-rw-r--r--format/pack/ingest/api.go22
1 files changed, 18 insertions, 4 deletions
diff --git a/format/pack/ingest/api.go b/format/pack/ingest/api.go
index 9e222c1d..f24bf83d 100644
--- a/format/pack/ingest/api.go
+++ b/format/pack/ingest/api.go
@@ -8,6 +8,22 @@ import (
"codeberg.org/lindenii/furgit/objectstore"
)
+// Options controls one pack ingest operation.
+type Options struct {
+ // FixThin appends missing local bases for thin packs.
+ FixThin bool
+ // WriteRev writes a .rev alongside the .pack and .idx.
+ WriteRev bool
+ // Base supplies existing objects for thin-pack fixup.
+ Base objectstore.Store
+ // RequireTrailingEOF requires the source to hit EOF after the pack trailer.
+ //
+ // This is suitable for exact pack-file readers, but should be disabled for
+ // full-duplex transport streams like receive-pack where the peer keeps the
+ // connection open to read the server response.
+ RequireTrailingEOF bool
+}
+
// Result describes one successful ingest transaction.
type Result struct {
// PackName is the destination-relative filename of the written .pack.
@@ -39,11 +55,9 @@ func Ingest(
src io.Reader,
destination *os.Root,
algo objectid.Algorithm,
- fixThin bool,
- writeRev bool,
- base objectstore.Store,
+ opts Options,
) (Result, error) {
- state, err := newIngestState(src, destination, algo, fixThin, writeRev, base)
+ state, err := newIngestState(src, destination, algo, opts)
if err != nil {
return Result{}, err
}