]> Sergey Matveev's repositories - public-inbox.git/commitdiff
solver: do not show redundant URLs in log
authorEric Wong <e@80x24.org>
Sat, 10 Sep 2022 20:10:24 +0000 (20:10 +0000)
committerEric Wong <e@80x24.org>
Sun, 11 Sep 2022 19:25:47 +0000 (19:25 +0000)
Messages in /all/ can get duplicated at times due to
list-appended signatures or buggy/malicious clients.
They'll all show up based on /$INBOX/$MSGID/,
so deduplicate the URLs to avoid noise.

lib/PublicInbox/SolverGit.pm

index ac655f3442693852fbc7798c1b4fa3a53b3f9ee7..b723b48a9f6545ef7724b5605666a53ab3d7b361 100644 (file)
@@ -554,8 +554,9 @@ sub extract_diffs_done {
        my $diffs = delete $self->{tmp_diffs};
        if (scalar @$diffs) {
                unshift @{$self->{patches}}, @$diffs;
-               dbg($self, "found $want->{oid_b} in " .  join(" ||\n\t",
-                       map { di_url($self, $_) } @$diffs));
+               my %seen; # List::Util::uniq requires Perl 5.26+ :<
+               my @u = grep { !$seen{$_}++ } map { di_url($self, $_) } @$diffs;
+               dbg($self, "found $want->{oid_b} in " .  join(" ||\n\t", @u));
                ++$self->{nr_p};
 
                # good, we can find a path to the oid we $want, now