From df73a4c6f1b58075316ba7449fbfb127b9fbb79d Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 29 Mar 2026 14:42:13 +0000 Subject: commitquery: Reorganize --- commitquery/node_generation.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'commitquery/node_generation.go') diff --git a/commitquery/node_generation.go b/commitquery/node_generation.go index b04f3762..03283cf6 100644 --- a/commitquery/node_generation.go +++ b/commitquery/node_generation.go @@ -6,7 +6,7 @@ import ( objectid "codeberg.org/lindenii/furgit/object/id" ) -// EffectiveGeneration returns one node's generation value. +// effectiveGeneration returns one node's generation value. func (query *query) effectiveGeneration(idx nodeIndex) uint64 { if !query.nodes[idx].hasGeneration { return generationInfinity @@ -15,10 +15,12 @@ func (query *query) effectiveGeneration(idx nodeIndex) uint64 { return query.nodes[idx].generation } +// generationInfinity sorts nodes without a known generation last. const ( generationInfinity = uint64(math.MaxUint64) ) +// compareByGeneration builds one comparator ordered by generation first. func (query *query) compareByGeneration() func(nodeIndex, nodeIndex) int { return func(left, right nodeIndex) int { leftGeneration := query.effectiveGeneration(left) -- cgit v1.3.1-10-gc9f91