aboutsummaryrefslogtreecommitdiff
path: root/commitquery/node_paint_down_to_common.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-29 14:07:17 +0000
committerGravatar Runxi Yu2026-03-29 14:07:17 +0000
commit3fdec79ddcafde9848b60fc420bb9222a4786e1f (patch)
treee3aab1efe7576d8b8ffb8afc9e7c1122d57e431d /commitquery/node_paint_down_to_common.go
parentinternal/heap: Much more reasonable binary heap (diff)
signatureNo signature
commitquery: Use internal/heap for the priority queue
Diffstat (limited to 'commitquery/node_paint_down_to_common.go')
-rw-r--r--commitquery/node_paint_down_to_common.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/commitquery/node_paint_down_to_common.go b/commitquery/node_paint_down_to_common.go
index 6bb1f489..a9618c2d 100644
--- a/commitquery/node_paint_down_to_common.go
+++ b/commitquery/node_paint_down_to_common.go
@@ -21,8 +21,15 @@ func (query *query) paintDownToCommon(left nodeIndex, rights []nodeIndex, minGen
lastGeneration := generationInfinity
- for query.queueHasNonStale(queue) {
- idx := queue.PopNode()
+ for queue.Len() > 0 {
+ idx, ok := queue.PopNode()
+ if !ok {
+ break
+ }
+
+ if query.hasAnyMarks(idx, markStale) {
+ continue
+ }
generation := query.effectiveGeneration(idx)
if generation > lastGeneration {