Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

receivepack: Lifecycle/ownership docs

Runxi Yu 13507b77 0f67e6f5

+16 -2
+5 -1
receivepack/hook.go
··· 30 30 31 31 // HookRequest is the input presented to a receive-pack hook before quarantine 32 32 // promotion and ref updates. 33 + // 34 + // Refs, ExistingObjects, and QuarantinedObjects are borrowed and are only 35 + // valid for the duration of the hook call. 33 36 type HookRequest struct { 34 37 Refs refstore.ReadingStore 35 38 ExistingObjects objectstore.Store ··· 43 46 // 44 47 // The hook runs after pack ingestion into quarantine and before quarantine 45 48 // promotion or ref updates. The returned decisions must have the same length as 46 - // HookRequest.Updates. 49 + // HookRequest.Updates. Hook borrows the data and stores in HookRequest only for 50 + // the duration of the call. 47 51 type Hook func(context.Context, HookRequest) ([]UpdateDecision, error) 48 52 49 53 func translateHook(hook Hook) service.Hook {
+8 -1
receivepack/options.go
··· 9 9 ) 10 10 11 11 // Options configures one receive-pack invocation. 12 + // 13 + // ReceivePack borrows all configured dependencies. 14 + // 15 + // Refs and ExistingObjects are required and must be non-nil. 16 + // ObjectsRoot is required if the invocation may need to ingest or promote a 17 + // pack. 12 18 type Options struct { 13 19 // GitProtocol is the raw Git protocol version string from the transport, 14 20 // such as "version=1". ··· 27 33 // directories moved from quarantine into the permanent object store. 28 34 PromotedObjectPermissions *PromotedObjectPermissions 29 35 // Hook, when non-nil, runs after pack ingestion into quarantine and before 30 - // quarantine promotion or ref updates. 36 + // quarantine promotion or ref updates. Hook is borrowed for the duration of 37 + // ReceivePack. 31 38 Hook Hook 32 39 // Agent is the receive-pack agent string advertised via capability. 33 40 //
+3
receivepack/receivepack.go
··· 19 19 // feels a bit ugly. 20 20 21 21 // ReceivePack serves one receive-pack session over r/w. 22 + // 23 + // ReceivePack borrows r, w, and all dependencies reachable through opts for 24 + // the duration of the call. It does not close any of them. 22 25 func ReceivePack( 23 26 ctx context.Context, 24 27 w pktline.WriteFlusher,