From a041d523de389b65b98a5373a8034041db2a8d83 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 2 Apr 2026 06:23:30 +0000 Subject: *: Remove --- commitquery/node_generation.go | 45 ------------------------------------------ 1 file changed, 45 deletions(-) delete mode 100644 commitquery/node_generation.go (limited to 'commitquery/node_generation.go') diff --git a/commitquery/node_generation.go b/commitquery/node_generation.go deleted file mode 100644 index 03283cf6..00000000 --- a/commitquery/node_generation.go +++ /dev/null @@ -1,45 +0,0 @@ -package commitquery - -import ( - "math" - - objectid "codeberg.org/lindenii/furgit/object/id" -) - -// effectiveGeneration returns one node's generation value. -func (query *query) effectiveGeneration(idx nodeIndex) uint64 { - if !query.nodes[idx].hasGeneration { - return generationInfinity - } - - 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) - rightGeneration := query.effectiveGeneration(right) - - switch { - case leftGeneration < rightGeneration: - return -1 - case leftGeneration > rightGeneration: - return 1 - } - - switch { - case query.nodes[left].commitTime < query.nodes[right].commitTime: - return -1 - case query.nodes[left].commitTime > query.nodes[right].commitTime: - return 1 - } - - return objectid.Compare(query.nodes[left].id, query.nodes[right].id) - } -} -- cgit v1.3.1-10-gc9f91