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

Method Less

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

Source from the content-addressed store, hash-verified

35}
36
37func (b BugsByEditTime) Less(i, j int) bool {
38 if b[i].EditLamportTime() < b[j].EditLamportTime() {
39 return true
40 }
41
42 if b[i].EditLamportTime() > b[j].EditLamportTime() {
43 return false
44 }
45
46 // When the logical clocks are identical, that means we had a concurrent
47 // edition. In this case we rely on the timestamp. While the timestamp might
48 // be incorrect due to a badly set clock, the drift in sorting is bounded
49 // by the first sorting using the logical clock. That means that if users
50 // synchronize their bugs regularly, the timestamp will rarely be used, and
51 // should still provide a kinda accurate sorting when needed.
52 return b[i].LastOp().Time().Before(b[j].LastOp().Time())
53}
54
55func (b BugsByEditTime) Swap(i, j int) {
56 b[i], b[j] = b[j], b[i]

Callers

nothing calls this directly

Calls 3

EditLamportTimeMethod · 0.65
TimeMethod · 0.65
LastOpMethod · 0.65

Tested by

no test coverage detected