18 my $HEADERMATCH = qr/ [a-z]+ (?: (?:-\w+)+ | \ by ) /ix;
24 # strip commit seperator
26 # skip expensive checks without potential identifier
28 # try to parse as UTF-8
29 eval { $_ = decode(utf8 => $_, Encode::FB_CROAK()) };
30 # if invalid, assume it's latin1
31 $_ = decode(cp1252 => $_) if $@;
37 for (reverse split /\n\n/) {
54 given ($opt{simplify} // 'no') {
59 < [^@>]+ (?: @ | \h?\W? at \W?\h? ) [a-z0-9.-]+ >
64 when ($header[0] =~ /[ _-] (?: by | to ) $/imsx) {
68 s{\b (https?)://\S+ }{[$1]}gmsx; # url
69 s{(?: < | \A ) [^@>\s]+ @ [^>]+ (?: > | \Z )}{<...>}igmsx; # address
70 s{\b [0-9]+ \b}{[num]}gmsx; # number
71 s{\b I? [0-9a-f]{40} \b}{[sha1]}gmsx; # hash
74 when (['all', 'any']) {
80 die "Unknown simplify option: '$_'\n";
84 if ($opt{'ignore-case'}) {
88 push @headers, \@header;
91 next BLOCK if not @headers;
93 if ($opt{debug} and $prefix) {
94 say "infix junk in commit $hash";
100 next if $seen->{ $_->[0] }->{ $_->[1] // '' }++;