blob: 2d133435a306deb11afadbf8244e24733f2e514e (
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
26
27
28
29
30
31
32
33
34
|
package commitquery
import "slices"
// mergeBases returns internal merge-base candidates for two resolved nodes.
func (query *query) mergeBases(left, right nodeIndex) ([]nodeIndex, error) {
if left == right {
return []nodeIndex{left}, nil
}
err := query.paintDownToCommon(left, []nodeIndex{right}, 0)
if err != nil {
return nil, err
}
candidates := query.collectMarkedResults()
if len(candidates) <= 1 {
slices.SortFunc(candidates, query.compare)
return candidates, nil
}
query.clearTouchedMarks(allMarks)
reduced, err := removeRedundant(query, candidates)
if err != nil {
return nil, err
}
slices.SortFunc(reduced, query.compare)
return reduced, nil
}
|