receivepack

package
v0.1.159 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package receivepack provides the application-facing server-side push entry point.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingAlgorithm reports one missing repository hash algorithm.
	ErrMissingAlgorithm = errors.New("receivepack: missing object id algorithm")
	// ErrMissingRefs reports one missing reference store dependency.
	ErrMissingRefs = errors.New("receivepack: missing refs store")
	// ErrMissingObjects reports one missing object store dependency.
	ErrMissingObjects = errors.New("receivepack: missing objects store")
	// ErrUnsupportedProtocol reports one unsupported requested Git protocol
	// version.
	ErrUnsupportedProtocol = errors.New("receivepack: unsupported protocol version")
)

Functions

func ReceivePack

func ReceivePack(
	ctx context.Context,
	w iowrap.WriteFlusher,
	r io.Reader,
	opts Options,
) error

ReceivePack serves one receive-pack session over r/w.

Labels: Deps-Borrowed.

Types

type Hook

Hook decides whether each requested update should proceed.

The hook runs after pack ingestion into quarantine and before quarantine promotion or ref updates. The returned decisions must have the same length as HookRequest.Updates.

type HookIO

type HookIO struct {
	Progress iowrap.WriteFlusher
	Error    iowrap.WriteFlusher
}

type HookRequest

type HookRequest struct {
	Refs               refstore.ReadingStore
	ExistingObjects    objectstore.Reader
	QuarantinedObjects objectstore.Reader
	CommitGraph        *commitgraphread.Reader
	Updates            []RefUpdate
	PushOptions        []string
	IO                 HookIO
}

HookRequest is the input presented to a receive-pack hook before quarantine promotion and ref updates.

Labels: Life-Call.

type Options

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.ReadWriteStore
	// ExistingObjects is the object store visible to the push before any newly
	// uploaded quarantined objects are promoted.
	ExistingObjects objectstore.Reader
	// CommitGraph is an optional commit-graph snapshot corresponding to
	// ExistingObjects.
	CommitGraph *commitgraphread.Reader
	// ObjectsRoot is the permanent object storage root beneath which per-push
	// quarantine directories are derived.
	ObjectsRoot *os.Root
	// PromotedObjectPermissions, when non-nil, is applied to objects and
	// directories moved from quarantine into the permanent object store.
	PromotedObjectPermissions *PromotedObjectPermissions
	// Hook, when non-nil, runs after pack ingestion into quarantine and before
	// quarantine promotion or ref updates. Hook is borrowed for the duration of
	// ReceivePack.
	Hook Hook
	// Agent is the receive-pack agent string advertised via capability.
	//
	// When empty, ReceivePack derives one from build info and falls back to
	// "furgit".
	Agent string
	// SessionID is the advertised receive-pack session-id capability value.
	//
	// When empty, ReceivePack generates one random value per invocation.
	SessionID string
	// PushCertNonce is the advertised push-cert nonce capability value.
	//
	// When empty, ReceivePack generates one random value per invocation.
	PushCertNonce string
}

Options configures one receive-pack invocation.

ReceivePack borrows all configured dependencies.

Refs and ExistingObjects are required and must be non-nil. ObjectsRoot is required if the invocation may need to ingest or promote a pack.

type PromotedObjectPermissions

type PromotedObjectPermissions struct {
	DirMode  fs.FileMode
	FileMode fs.FileMode
}

PromotedObjectPermissions configures the destination permissions applied to objects and directories promoted out of quarantine.

type RefUpdate

type RefUpdate struct {
	Name  string
	OldID objectid.ObjectID
	NewID objectid.ObjectID
}

RefUpdate is one requested reference update presented to a receive-pack hook.

type UpdateDecision

type UpdateDecision struct {
	Accept  bool
	Message string
}

UpdateDecision is one hook decision for a requested reference update.

Directories

Path Synopsis
Package hooks provides a few pre-defined hooks that callers might find useful.
Package hooks provides a few pre-defined hooks that callers might find useful.
Package service implements the protocol-independent receive-pack service.
Package service implements the protocol-independent receive-pack service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL