···3232// HookRequest is the input presented to a receive-pack hook before quarantine
3333// promotion and ref updates.
3434//
3535-// Refs, ExistingObjects, QuarantinedObjects, and CommitGraph are borrowed and
3636-// are only valid for the duration of the hook call.
3535+// Labels: Life-Call.
3736type HookRequest struct {
3837 Refs refstore.ReadingStore
3938 ExistingObjects objectstore.ReadingStore
···4847//
4948// The hook runs after pack ingestion into quarantine and before quarantine
5049// promotion or ref updates. The returned decisions must have the same length as
5151-// HookRequest.Updates. Hook borrows the data and stores in HookRequest only for
5252-// the duration of the call.
5050+// HookRequest.Updates.
5351type Hook func(context.Context, HookRequest) ([]UpdateDecision, error)
54525553func translateHook(hook Hook) service.Hook {
+1-2
network/receivepack/receivepack.go
···20202121// ReceivePack serves one receive-pack session over r/w.
2222//
2323-// ReceivePack borrows r, w, and all dependencies reachable through opts for
2424-// the duration of the call. It does not close any of them.
2323+// Labels: Deps-Borrowed.
2524func ReceivePack(
2625 ctx context.Context,
2726 w pktline.WriteFlusher,
+2
network/receivepack/service/execute.go
···991010// Execute validates one receive-pack request, optionally ingests its pack into
1111// quarantine, runs the optional hook, and applies allowed ref updates.
1212+//
1313+// Labels: Deps-Borrowed.
1214func (service *Service) Execute(ctx context.Context, req *Request) (*Result, error) {
1315 result := &Result{
1416 Commands: make([]CommandResult, 0, len(req.Commands)),
+3-5
network/receivepack/service/hook.go
···2626 Message string
2727}
28282929-// HookRequest is the borrowed view passed to one Hook invocation.
2929+// HookRequest is the view passed to one Hook invocation.
3030//
3131-// Refs, ExistingObjects, QuarantinedObjects, and CommitGraph are borrowed and
3232-// are only valid for the duration of the hook call.
3131+// Labels: Life-Call.
3332type HookRequest struct {
3433 Refs refstore.ReadingStore
3534 ExistingObjects objectstore.ReadingStore
···42414342// Hook is an optional per-request validation hook.
4443//
4545-// Hook borrows the data and stores in HookRequest only for the duration of the
4646-// call.
4444+// The returned decisions must have the same length as HookRequest.Updates.
4745type Hook func(context.Context, HookRequest) ([]UpdateDecision, error)
+1-4
network/receivepack/service/service.go
···11package service
2233// Service executes protocol-independent receive-pack requests.
44-//
55-// Service borrows all dependencies supplied in Options.
64type Service struct {
75 opts Options
86}
97108// New creates one receive-pack service.
119//
1212-// The returned service borrows opts and does not take ownership of any stores,
1313-// roots, hooks, or I/O endpoints reachable through it.
1010+// Labels: Deps-Borrowed.
1411func New(opts Options) *Service {
1512 return &Service{opts: opts}
1613}