Skip to content

Commit

Permalink
references: sort: compare author timestamps when commit timestamps ar…
Browse files Browse the repository at this point in the history
…e equal. Fixes src-d#725

Signed-off-by: Alexandr Krylovskiy <[email protected]>
  • Loading branch information
krylovsk committed Jan 21, 2018
1 parent f6aca08 commit ba267cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion references.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func (s commitSorterer) Len() int {
}

func (s commitSorterer) Less(i, j int) bool {
return s.l[i].Committer.When.Before(s.l[j].Committer.When)
return s.l[i].Committer.When.Before(s.l[j].Committer.When) ||
s.l[i].Committer.When.Equal(s.l[j].Committer.When) &&
s.l[i].Author.When.Before(s.l[j].Author.When)
}

func (s commitSorterer) Swap(i, j int) {
Expand Down

0 comments on commit ba267cb

Please sign in to comment.