From e0e493fbf197aabf9272e52ab0e7282e308bcdeb Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 29 Mar 2026 14:15:30 +0000 Subject: commitquery: Use our proper priority queue thingy --- commitquery/node_paint_down_to_common.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'commitquery/node_paint_down_to_common.go') 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) } } -- cgit v1.3.1-10-gc9f91