From 175c8ed3c342f34110cdca42dc4027050b39d7fb Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 7 Mar 2026 14:24:32 +0800 Subject: receivepack: Connect protocol with service --- receivepack/options.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 receivepack/options.go (limited to 'receivepack/options.go') 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 +} -- cgit v1.3.1-10-gc9f91