diff options
| author | 2026-03-04 08:26:56 +0800 | |
|---|---|---|
| committer | 2026-03-04 08:59:53 +0800 | |
| commit | ab7501be34032fb9e5c48726a68ae90a917af9eb (patch) | |
| tree | 20d005647569befea8133e953c3270e8fd2a2a5b /reachability/reachability.go | |
| parent | *: gofumpt (diff) | |
| signature | No signature | |
*: Lint
Diffstat (limited to 'reachability/reachability.go')
| -rw-r--r-- | reachability/reachability.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/reachability/reachability.go b/reachability/reachability.go index 0bec055f..93bc840b 100644 --- a/reachability/reachability.go +++ b/reachability/reachability.go @@ -26,10 +26,12 @@ func (r *Reachability) IsAncestor(ancestor, descendant objectid.ObjectID) (bool, if err != nil { return false, err } + descendantCommit, err := r.peelRootToDomain(descendant, DomainCommits) if err != nil { return false, err } + if ancestorCommit == descendantCommit { return true, nil } @@ -40,9 +42,12 @@ func (r *Reachability) IsAncestor(ancestor, descendant objectid.ObjectID) (bool, return true, nil } } - if err := walk.Err(); err != nil { + + err = walk.Err() + if err != nil { return false, err } + return false, nil } @@ -53,6 +58,7 @@ func (r *Reachability) CheckConnected(domain Domain, haves, wants map[objectid.O walk := r.Walk(domain, haves, wants) for range walk.Seq() { } + return walk.Err() } @@ -64,8 +70,11 @@ func (r *Reachability) Walk(domain Domain, haves, wants map[objectid.ObjectID]st haves: haves, wants: wants, } - if err := validateDomain(domain); err != nil { + + err := validateDomain(domain) + if err != nil { walk.err = err } + return walk } |
