lib/PublicInbox/Import.pm | 6 ++++-- script/public-inbox-learn | 2 +- diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 31dc769583bd32777e2d25e16de743fd507a65c0..8c9d1cbad526a7d1e5dd3813f390685a0cd3713b 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -90,7 +90,7 @@ # returns undef on non-existent # ('MISMATCH', msg) on mismatch # (:MARK, msg) on success sub remove { - my ($self, $mime) = @_; # mime = Email::MIME + my ($self, $mime, $msg) = @_; # mime = Email::MIME my $mid = mid_mime($mime); my $path = mid2path($mid); @@ -138,10 +138,12 @@ print $w "reset $ref\n" or wfail; } my $ident = $self->{ident}; my $now = now2822(); + $msg ||= 'rm'; + my $len = length($msg) + 1; print $w "commit $ref\nmark :$commit\n", "author $ident $now\n", "committer $ident $now\n", - "data 3\nrm\n\n", + "data $len\n$msg\n\n", 'from ', ($parent ? $parent : $tip), "\n" or wfail; print $w "D $path\n\n" or wfail; $self->{nchg}++; diff --git a/script/public-inbox-learn b/script/public-inbox-learn index 71aa50f9d5989b093b4efa50f4312267f8ce6440..75294a0a8e44e9368fc0b98d7db38d1d8a71152b 100755 --- a/script/public-inbox-learn +++ b/script/public-inbox-learn @@ -81,7 +81,7 @@ # This needs to be idempotent, as my inotify trainer # may train for each cross-posted message, and this # script already learns for every list in # ~/.public-inbox/config - $im->remove($mime); + $im->remove($mime, $train); } else { # $train eq "ham" # no checking for spam here, we assume the message has # been reviewed by a human at this point: