aboutsummaryrefslogtreecommitdiff
path: root/reachability
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-05-20 16:52:22 +0000
committerGravatar Runxi Yu2026-05-20 16:52:22 +0000
commit7e1f61e1e6ce9c09fef68be6818d4c7162b54fa8 (patch)
tree583713861f5df7a05fdb93d172545cc1ae8fdd25 /reachability
parentref/store: More bikeshedding (diff)
signatureNo signature
reachability: CheckConnected should get a strict option
Diffstat (limited to 'reachability')
-rw-r--r--reachability/connected.go9
-rw-r--r--reachability/integration_test.go1
-rw-r--r--reachability/unit_test.go2
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")
}