aboutsummaryrefslogtreecommitdiff
path: root/receivepack/options.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-07 14:24:32 +0800
committerGravatar Runxi Yu2026-03-07 17:21:05 +0800
commit175c8ed3c342f34110cdca42dc4027050b39d7fb (patch)
tree8e0ddddc5b7146816f859c2013c7fb7909807e03 /receivepack/options.go
parentreceivepack: Add service semantics thingy (diff)
signatureNo signature
receivepack: Connect protocol with service v0.1.72
Diffstat (limited to 'receivepack/options.go')
-rw-r--r--receivepack/options.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/receivepack/options.go b/receivepack/options.go
new file mode 100644
index 00000000..56b4a006
--- /dev/null
+++ b/receivepack/options.go
@@ -0,0 +1,43 @@
+package receivepack
+
+import (
+ "os"
+
+ "codeberg.org/lindenii/furgit/objectid"
+ "codeberg.org/lindenii/furgit/objectstore"
+ "codeberg.org/lindenii/furgit/refstore"
+)
+
+// Options configures one receive-pack invocation.
+type Options struct {
+ // GitProtocol is the raw Git protocol version string from the transport,
+ // such as "version=1".
+ GitProtocol string
+ // Algorithm is the repository object ID algorithm used by the push session.
+ Algorithm objectid.Algorithm
+ // Refs is the reference store visible to the push.
+ Refs refstore.ReadingStore
+ // ExistingObjects is the object store visible to the push before any newly
+ // uploaded quarantined objects are promoted.
+ ExistingObjects objectstore.Store
+ // ObjectsRoot is the permanent object storage root beneath which per-push
+ // quarantine directories are derived.
+ ObjectsRoot *os.Root
+ // TODO: Hook and policy callbacks.
+}
+
+func validateOptions(opts Options) error {
+ if opts.Algorithm == 0 {
+ return ErrMissingAlgorithm
+ }
+
+ if opts.Refs == nil {
+ return ErrMissingRefs
+ }
+
+ if opts.ExistingObjects == nil {
+ return ErrMissingObjects
+ }
+
+ return nil
+}