Commit Diff
Diff:
debcbab21044d4ed53603bc14f0532ba6b3ba0b5
257d7c99293530caf1a1946dc1c649ce5b6f2966
Commit:
257d7c99293530caf1a1946dc1c649ce5b6f2966
Tree:
de889d08e90d99785a99934307ebd8935a65a270
Author:
Omar Polo <op@omarpolo.com>
Date:
Tue Oct 4 16:56:35 2022 UTC
Message:
fix last sender name/date in the index

pick up the *latest* From/Date for the indexes, not what happened to be
the last mail rendered in that thread.

spotted by stsp@
commit - debcbab21044d4ed53603bc14f0532ba6b3ba0b5
commit + 257d7c99293530caf1a1946dc1c649ce5b6f2966
blob - 5a543bbae24d8d5c7b11e208fe99d887809b228e
blob + c059ce5eb02d2aef78682f236e2fe94e06e4be1b
--- mkindex
+++ mkindex
@@ -210,10 +210,17 @@ while (<>) {
index_entry $pfh, $last_tid, $last_date, $last_from, $last_subj
if defined $last_tid && $level == 0;
- $last_tid = $mid if $level == 0;
- $last_date = $date;
- $last_from = $from;
- $last_subj = $subj if $level == 0;
+ # `gt' on dates works because the format used allow for
+ # lexicographic comparisons.
+ if ($level == 0 || $date gt $last_date) {
+ $last_date = $date;
+ $last_from = $from;
+ }
+
+ if ($level == 0) {
+ $last_tid = $mid;
+ $last_subj = $subj;
+ }
}
index_entry $pfh, $last_tid, $last_date, $last_from, $last_subj
Omar Polo