From 7e1f61e1e6ce9c09fef68be6818d4c7162b54fa8 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 20 May 2026 16:52:22 +0000 Subject: reachability: CheckConnected should get a strict option --- reachability/connected.go | 9 +++++---- reachability/integration_test.go | 1 + reachability/unit_test.go | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/reachability/connected.go b/reachability/connected.go index 96211079..655c40b9 100644 --- a/reachability/connected.go +++ b/reachability/connected.go @@ -6,12 +6,13 @@ import objectid "codeberg.org/lindenii/furgit/object/id" // selected domain) can be fully traversed without missing-object/type/parse // errors, excluding subgraphs rooted at haves. // -// Even with commit-graph acceleration available, each visited commit is -// still validated against the object store. -func (r *Reachability) CheckConnected(domain Domain, haves, wants map[objectid.ObjectID]struct{}) error { +// With commit-graph acceleration available, +// each visited commit is validated against the object store +// iff struct is set to true. +func (r *Reachability) CheckConnected(domain Domain, haves, wants map[objectid.ObjectID]struct{}, strict bool) error { walk := r.Walk(domain, haves, wants) - walk.strict = true + walk.strict = strict for range walk.Seq() { } diff --git a/reachability/integration_test.go b/reachability/integration_test.go index 20d9e3f7..2df938aa 100644 --- a/reachability/integration_test.go +++ b/reachability/integration_test.go @@ -183,6 +183,7 @@ func TestCheckConnectedMissingObject(t *testing.T) { reachability.DomainObjects, nil, map[objectid.ObjectID]struct{}{commitID: {}}, + false, ) if err == nil { t.Fatal("expected error") diff --git a/reachability/unit_test.go b/reachability/unit_test.go index 5be7f6fb..469c79ff 100644 --- a/reachability/unit_test.go +++ b/reachability/unit_test.go @@ -380,7 +380,7 @@ func TestCheckConnectedReturnsConcreteMissingObject(t *testing.T) { r := reachability.New(objectfetch.New(store), nil) - err = r.CheckConnected(reachability.DomainCommits, nil, map[objectid.ObjectID]struct{}{commit: {}}) + err = r.CheckConnected(reachability.DomainCommits, nil, map[objectid.ObjectID]struct{}{commit: {}}, false) if err == nil { t.Fatal("expected error") } -- cgit v1.3.1-10-gc9f91