shithub: furgit

Download patch

ref: 82f8ae0392250f0de127fcd7a5da21587e9e589c
parent: da621b97d0aa209e7e502e9e898e0a7a89857216
author: Runxi Yu <runxiyu@umich.edu>
date: Mon Mar 30 15:53:06 EDT 2026

network/receivepack: Cleanup; also document QuarantinedObjects nullness

--- a/network/receivepack/hook.go
+++ b/network/receivepack/hook.go
@@ -34,8 +34,11 @@
 //
 // Labels: Life-Call.
 type HookRequest struct {
-	Refs               refstore.ReadingStore
-	ExistingObjects    objectstore.Reader
+	Refs            refstore.ReadingStore
+	ExistingObjects objectstore.Reader
+	// QuarantinedObjects exposes quarantined objects for this push.
+	//
+	// When the push did not create a quarantine, QuarantinedObjects is nil.
 	QuarantinedObjects objectstore.Reader
 	CommitGraph        *commitgraphread.Reader
 	Updates            []RefUpdate
--- a/network/receivepack/hooks/reject_force_push.go
+++ b/network/receivepack/hooks/reject_force_push.go
@@ -21,7 +21,10 @@
 	) ([]receivepack.UpdateDecision, error) {
 		_ = ctx
 
-		objects := objectmix.New(req.QuarantinedObjects, req.ExistingObjects)
+		objects := req.ExistingObjects
+		if req.QuarantinedObjects != nil {
+			objects = objectmix.New(req.QuarantinedObjects, req.ExistingObjects)
+		}
 
 		queries := commitquery.New(fetch.New(objects), req.CommitGraph)
 
--- a/network/receivepack/receivepack.go
+++ b/network/receivepack/receivepack.go
@@ -105,7 +105,6 @@
 	}
 
 	svc := service.New(service.Options{
-		Algorithm:       opts.Algorithm,
 		Refs:            opts.Refs,
 		ExistingObjects: opts.ExistingObjects,
 		ObjectIngress:   opts.ObjectIngress,
--- a/network/receivepack/service/hook.go
+++ b/network/receivepack/service/hook.go
@@ -30,8 +30,11 @@
 //
 // Labels: Life-Call.
 type HookRequest struct {
-	Refs               refstore.ReadingStore
-	ExistingObjects    objectstore.Reader
+	Refs            refstore.ReadingStore
+	ExistingObjects objectstore.Reader
+	// QuarantinedObjects exposes quarantined objects for this push.
+	//
+	// When the push did not create a quarantine, QuarantinedObjects is nil.
 	QuarantinedObjects objectstore.Reader
 	CommitGraph        *commitgraphread.Reader
 	Updates            []RefUpdate
--- a/network/receivepack/service/options.go
+++ b/network/receivepack/service/options.go
@@ -3,7 +3,6 @@
 import (
 	"codeberg.org/lindenii/furgit/common/iowrap"
 	commitgraphread "codeberg.org/lindenii/furgit/format/commitgraph/read"
-	objectid "codeberg.org/lindenii/furgit/object/id"
 	objectstore "codeberg.org/lindenii/furgit/object/store"
 	refstore "codeberg.org/lindenii/furgit/ref/store"
 )
@@ -18,8 +17,7 @@
 // CommitGraph, Progress, Hook, and HookIO are optional; when provided they are also
 // borrowed for the duration of Execute.
 type Options struct {
-	Algorithm objectid.Algorithm
-	Refs      interface {
+	Refs interface {
 		refstore.ReadingStore
 		refstore.TransactionalStore
 		refstore.BatchStore
--- a/network/receivepack/service/service_test.go
+++ b/network/receivepack/service/service_test.go
@@ -25,7 +25,6 @@
 
 		store := memory.New(algo)
 		svc := service.New(service.Options{
-			Algorithm:       algo,
 			ExistingObjects: store,
 		})
 
@@ -59,7 +58,6 @@
 		objectIngress := newDualIngress(t, algo)
 
 		svc := service.New(service.Options{
-			Algorithm:       algo,
 			ExistingObjects: store,
 			ObjectIngress:   objectIngress,
 		})
--