diff options
| author | 2026-03-29 14:42:13 +0000 | |
|---|---|---|
| committer | 2026-03-29 14:47:04 +0000 | |
| commit | df73a4c6f1b58075316ba7449fbfb127b9fbb79d (patch) | |
| tree | 62fee259ec037410b06419ee3ac9c2c189c35ab3 /commitquery/node_generation.go | |
| parent | internal/priorityqueue: Update docs (diff) | |
| signature | No signature | |
commitquery: Reorganize
Diffstat (limited to 'commitquery/node_generation.go')
| -rw-r--r-- | commitquery/node_generation.go | 4 |
1 files changed, 3 insertions, 1 deletions
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) |
