]> Sergey Matveev's repositories - public-inbox.git/commitdiff
feed: merge subjects regardless of "[PATCH vN]"
authorEric Wong <e@80x24.org>
Tue, 25 Aug 2015 01:55:44 +0000 (01:55 +0000)
committerEric Wong <e@80x24.org>
Tue, 25 Aug 2015 09:06:02 +0000 (09:06 +0000)
This normalizes rerolled patches with identical topics,
but does not normalize different patches even if they are
in the same thread (for now).

lib/PublicInbox/Feed.pm

index 69ce59bd8cde5b70908c0099fdf6c6369bf70044..a0f901ebd6fc586dd38f29dc694386dee72f991c 100644 (file)
@@ -332,8 +332,12 @@ sub add_topic {
                $subj = mime_header($header_obj, 'Subject');
        }
 
-       $subj = $srch->subject_normalized($subj);
-       if (++$subjs->{$subj} == 1) {
+       my $topic = $subj = $srch->subject_normalized($subj);
+
+       # kill "[PATCH v2]" etc. for summarization
+       $topic =~ s/\A\s*\[[^\]]+\]\s*//g;
+
+       if (++$subjs->{$topic} == 1) {
                unless ($header_obj) {
                        my $mime = do_cat_mail($git, $path) or return 0;
                        $header_obj = $mime->header_obj;