Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 25 lines 673 B view raw
1package commitquery 2 3import objectid "codeberg.org/lindenii/furgit/object/id" 4 5// compare orders two internal nodes using merge-base queue ordering. 6func (query *query) compare(left, right nodeIndex) int { 7 leftGeneration := query.effectiveGeneration(left) 8 rightGeneration := query.effectiveGeneration(right) 9 10 switch { 11 case leftGeneration < rightGeneration: 12 return -1 13 case leftGeneration > rightGeneration: 14 return 1 15 } 16 17 switch { 18 case query.nodes[left].commitTime < query.nodes[right].commitTime: 19 return -1 20 case query.nodes[left].commitTime > query.nodes[right].commitTime: 21 return 1 22 } 23 24 return objectid.Compare(query.nodes[left].id, query.nodes[right].id) 25}