···30303131// HookRequest is the input presented to a receive-pack hook before quarantine
3232// promotion and ref updates.
3333+//
3434+// Refs, ExistingObjects, and QuarantinedObjects are borrowed and are only
3535+// valid for the duration of the hook call.
3336type HookRequest struct {
3437 Refs refstore.ReadingStore
3538 ExistingObjects objectstore.Store
···4346//
4447// The hook runs after pack ingestion into quarantine and before quarantine
4548// promotion or ref updates. The returned decisions must have the same length as
4646-// HookRequest.Updates.
4949+// HookRequest.Updates. Hook borrows the data and stores in HookRequest only for
5050+// the duration of the call.
4751type Hook func(context.Context, HookRequest) ([]UpdateDecision, error)
48524953func translateHook(hook Hook) service.Hook {
+8-1
receivepack/options.go
···99)
10101111// Options configures one receive-pack invocation.
1212+//
1313+// ReceivePack borrows all configured dependencies.
1414+//
1515+// Refs and ExistingObjects are required and must be non-nil.
1616+// ObjectsRoot is required if the invocation may need to ingest or promote a
1717+// pack.
1218type Options struct {
1319 // GitProtocol is the raw Git protocol version string from the transport,
1420 // such as "version=1".
···2733 // directories moved from quarantine into the permanent object store.
2834 PromotedObjectPermissions *PromotedObjectPermissions
2935 // Hook, when non-nil, runs after pack ingestion into quarantine and before
3030- // quarantine promotion or ref updates.
3636+ // quarantine promotion or ref updates. Hook is borrowed for the duration of
3737+ // ReceivePack.
3138 Hook Hook
3239 // Agent is the receive-pack agent string advertised via capability.
3340 //
+3
receivepack/receivepack.go
···1919// feels a bit ugly.
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.
2225func ReceivePack(
2326 ctx context.Context,
2427 w pktline.WriteFlusher,