From e4f8e96c6e7548e8594953d1327f700a6c5162fb Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 16 Jul 2026 09:42:13 -1000 Subject: Compare repository idle times by sign The idle-sort comparator returned a 64-bit time difference truncated to int, which could flip sign and leave the ordering inconsistent. --- source/ui-repolist.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/ui-repolist.c b/source/ui-repolist.c index fc198e5..9c4fd6f 100644 --- a/source/ui-repolist.c +++ b/source/ui-repolist.c @@ -242,7 +242,13 @@ static int sort_idle(const void *a, const void *b) t1 = t2 = 0; get_repo_modtime(r1, &t1); get_repo_modtime(r2, &t2); - return t2 - t1; + /* Return the sign only; a truncated 64-bit time_t difference could + * flip and make the comparator inconsistent. */ + if (t2 > t1) + return 1; + if (t2 < t1) + return -1; + return 0; } static int sort_section(const void *a, const void *b) -- cgit v2.8.0