X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fthread.cc;fp=lib%2Fthread.cc;h=dbac002fd7130c4c7559dcf96fbb9b90bdab2487;hp=3561b27f743976d2c2d1918d33fc2a8d33469c74;hb=9293d6da27494d7b607c945c6678bc890749b94f;hpb=ab55ca8e0a84b8e00e42860fa0025c1ae86b4478 diff --git a/lib/thread.cc b/lib/thread.cc index 3561b27f..dbac002f 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -397,7 +397,13 @@ _resolve_thread_relationships (notmuch_thread_t *thread) for (node = thread->message_list->head; node; node = node->next) { message = node->message; in_reply_to = _notmuch_message_get_in_reply_to (message); - if (in_reply_to && strlen (in_reply_to) && + /* + * if we reach the end of the list without finding a top-level + * message, that means the thread is a cycle (or set of + * cycles) and any message can be considered top-level + */ + if ((thread->toplevel_list->head || node->next) && + in_reply_to && strlen (in_reply_to) && g_hash_table_lookup_extended (thread->message_hash, in_reply_to, NULL, (void **) &parent))