about summary refs log tree commit homepage
path: root/lib/msgthr.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-04-26 00:01:56 +0000
committerEric Wong <e@80x24.org>2018-04-26 00:02:24 +0000
commit370d1e01ac9a81c10aa1cc3dea256337f94321c9 (patch)
treeca724eb755de8d54aa9eac56cc52b7db3013aa05 /lib/msgthr.rb
parent341e3ac6a07358c76b4e0690567949063cc70497 (diff)
downloadmsgthr-370d1e01ac9a81c10aa1cc3dea256337f94321c9.tar.gz
We failed to detect cyclic dependencies, leading to lost thread
roots.  In this Ruby version, I also screwed up the `seen' hash
check in a misguided effort to avoid an extra hash lookup.

The same algorithm was recently fixed in public-inbox:

  https://public-inbox.org/meta/20180425085249.14974-1-e@80x24.org/

Summarizing what happened with public-inbox: this algorithm can
still be thrown off when the References: order presented to us
is wrong, so sorting messages by age before feeding to
Msgthr#add can improve the results.

Regardless of ordering, messages should not become "lost" by the
algorithm.
Diffstat (limited to 'lib/msgthr.rb')
-rw-r--r--lib/msgthr.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/msgthr.rb b/lib/msgthr.rb
index bf4b14e..8619c62 100644
--- a/lib/msgthr.rb
+++ b/lib/msgthr.rb
@@ -183,7 +183,7 @@ class Msgthr
     end
 
     # set parent of this message to be the last element in refs
-    if prev
+    if prev && !cur.has_descendent(prev)
       prev.add_child(cur)
       yield(prev, cur) if block_given?
     end