aboutsummaryrefslogtreecommitdiff
path: root/commitquery/node_paint_down_to_common.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-29 14:15:30 +0000
committerGravatar Runxi Yu2026-03-29 14:15:30 +0000
commite0e493fbf197aabf9272e52ab0e7282e308bcdeb (patch)
tree183f4bc7db4489b5a276a3fbd614b3c3ac1b2276 /commitquery/node_paint_down_to_common.go
parentinternal/priorityqueue: Actually just make our own priority queue (diff)
signatureNo signature
commitquery: Use our proper priority queue thingy
Diffstat (limited to 'commitquery/node_paint_down_to_common.go')
-rw-r--r--commitquery/node_paint_down_to_common.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/commitquery/node_paint_down_to_common.go b/commitquery/node_paint_down_to_common.go
index a9618c2d..2fa24816 100644
--- a/commitquery/node_paint_down_to_common.go
+++ b/commitquery/node_paint_down_to_common.go
@@ -1,5 +1,7 @@
package commitquery
+import "codeberg.org/lindenii/furgit/internal/priorityqueue"
+
func (query *query) paintDownToCommon(left nodeIndex, rights []nodeIndex, minGeneration uint64) error {
query.beginMarkPhase()
@@ -11,18 +13,20 @@ func (query *query) paintDownToCommon(left nodeIndex, rights []nodeIndex, minGen
return nil
}
- queue := newPriorityQueue(query)
- queue.PushNode(left)
+ queue := priorityqueue.New(func(left, right nodeIndex) bool {
+ return query.compare(left, right) > 0
+ })
+ queue.Push(left)
for _, right := range rights {
query.setMarks(right, markRight)
- queue.PushNode(right)
+ queue.Push(right)
}
lastGeneration := generationInfinity
for queue.Len() > 0 {
- idx, ok := queue.PopNode()
+ idx, ok := queue.Pop()
if !ok {
break
}
@@ -54,7 +58,7 @@ func (query *query) paintDownToCommon(left nodeIndex, rights []nodeIndex, minGen
}
query.setMarks(parent, flags)
- queue.PushNode(parent)
+ queue.Push(parent)
}
}