MCPcopy Index your code
hub / github.com/git-bug/git-bug / Less

Method Less

entities/bug/sorting.go:9–25  ·  view source on GitHub ↗
(i, j int)

Source from the content-addressed store, hash-verified

7}
8
9func (b BugsByCreationTime) Less(i, j int) bool {
10 if b[i].CreateLamportTime() < b[j].CreateLamportTime() {
11 return true
12 }
13
14 if b[i].CreateLamportTime() > b[j].CreateLamportTime() {
15 return false
16 }
17
18 // When the logical clocks are identical, that means we had a concurrent
19 // edition. In this case we rely on the timestamp. While the timestamp might
20 // be incorrect due to a badly set clock, the drift in sorting is bounded
21 // by the first sorting using the logical clock. That means that if users
22 // synchronize their bugs regularly, the timestamp will rarely be used, and
23 // should still provide a kinda accurate sorting when needed.
24 return b[i].FirstOp().Time().Before(b[j].FirstOp().Time())
25}
26
27func (b BugsByCreationTime) Swap(i, j int) {
28 b[i], b[j] = b[j], b[i]

Callers

nothing calls this directly

Calls 3

CreateLamportTimeMethod · 0.65
TimeMethod · 0.65
FirstOpMethod · 0.65

Tested by

no test coverage detected