blob: 748ef71215803489601c1d3753038a49f0e5a4e5 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package commitquery
import "codeberg.org/lindenii/furgit/objectid"
// Compare compares two internal nodes using merge-base queue ordering.
func (ctx *Context) Compare(left, right NodeIndex) int {
leftGeneration := ctx.EffectiveGeneration(left)
rightGeneration := ctx.EffectiveGeneration(right)
switch {
case leftGeneration < rightGeneration:
return -1
case leftGeneration > rightGeneration:
return 1
}
switch {
case ctx.nodes[left].commitTime < ctx.nodes[right].commitTime:
return -1
case ctx.nodes[left].commitTime > ctx.nodes[right].commitTime:
return 1
}
return objectid.Compare(ctx.nodes[left].id, ctx.nodes[right].id)
}
|