]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
content_digest_dbg: improve display of To:/Cc: diffs
authorEric Wong <e@80x24.org>
Tue, 25 Apr 2023 10:50:52 +0000 (10:50 +0000)
committerEric Wong <e@80x24.org>
Tue, 25 Apr 2023 20:51:35 +0000 (20:51 +0000)
To: and Cc: headers can be long and differences in long lines
are easier to view when broken apart.  Just split by /,/ since
Data::Dumper will delimit with "," anyways.

lib/PublicInbox/ContentDigestDbg.pm

index 1e60364fbeb097f5a1b83a2b80aa0a6220031a8b..31d0f707083b496adc26f841a48744dac9d0d056 100644 (file)
@@ -10,7 +10,11 @@ sub new { bless [ PublicInbox::SHA->new(256), $_[1] ], __PACKAGE__ }
 
 sub add {
        $_[0]->[0]->add($_[1]);
-       print { $_[0]->[1] } Dumper([split(/^/sm, $_[1])]) or die "print $!";
+       my @dbg = split(/^/sm, $_[1]);
+       if ($dbg[0] =~ /\A(To|Cc)\0/) { # fold excessively long lines
+               @dbg = map { split(/,/s, $_) } @dbg;
+       }
+       print { $_[0]->[1] } Dumper(\@dbg) or die "print $!";
 }
 
 sub hexdigest { $_[0]->[0]->hexdigest }