aboutsummaryrefslogtreecommitdiff
path: root/commitquery/node_paint_down_to_common.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-29 14:42:13 +0000
committerGravatar Runxi Yu2026-03-29 14:47:04 +0000
commitdf73a4c6f1b58075316ba7449fbfb127b9fbb79d (patch)
tree62fee259ec037410b06419ee3ac9c2c189c35ab3 /commitquery/node_paint_down_to_common.go
parentinternal/priorityqueue: Update docs (diff)
signatureNo signature
commitquery: Reorganize
Diffstat (limited to 'commitquery/node_paint_down_to_common.go')
-rw-r--r--commitquery/node_paint_down_to_common.go66
1 files changed, 0 insertions, 66 deletions
diff --git a/commitquery/node_paint_down_to_common.go b/commitquery/node_paint_down_to_common.go
deleted file mode 100644
index 2fa24816..00000000
--- a/commitquery/node_paint_down_to_common.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package commitquery
-
-import "codeberg.org/lindenii/furgit/internal/priorityqueue"
-
-func (query *query) paintDownToCommon(left nodeIndex, rights []nodeIndex, minGeneration uint64) error {
- query.beginMarkPhase()
-
- query.setMarks(left, markLeft)
-
- if len(rights) == 0 {
- query.setMarks(left, markResult)
-
- return nil
- }
-
- 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.Push(right)
- }
-
- lastGeneration := generationInfinity
-
- for queue.Len() > 0 {
- idx, ok := queue.Pop()
- if !ok {
- break
- }
-
- if query.hasAnyMarks(idx, markStale) {
- continue
- }
-
- generation := query.effectiveGeneration(idx)
- if generation > lastGeneration {
- return errBadGenerationOrder
- }
-
- lastGeneration = generation
- if generation < minGeneration {
- break
- }
-
- flags := query.marks(idx) & (markLeft | markRight | markStale)
- if flags == (markLeft | markRight) {
- query.setMarks(idx, markResult)
-
- flags |= markStale
- }
-
- for _, parent := range query.parents(idx) {
- if query.hasAllMarks(parent, flags) {
- continue
- }
-
- query.setMarks(parent, flags)
- queue.Push(parent)
- }
- }
-
- return nil
-}