+
+my $nogit = PublicInbox::Git->new("$dir/non-existent/dir");
+eval {
+ my $nope = PublicInbox::Import->new($nogit, 'nope', 'no@example.com');
+ $nope->add($mime);
+};
+ok($@, 'Import->add fails on non-existent dir');
+
+my @cls = qw(PublicInbox::Eml);
+SKIP: {
+ require_mods('PublicInbox::MIME', 1);
+ push @cls, 'PublicInbox::MIME';
+};
+
+$main::badchars = "\n\0\r";
+my $from = '=?UTF-8?B?'. encode_base64("B\ra\nd\0\$main::badchars", ''). '?=';
+for my $cls (@cls) {
+ my $eml = $cls->new(<<EOF);
+From: $from <spammer\@example.com>
+Message-ID: <$cls\@example.com>
+
+EOF
+ ok($im->add($eml), "added $cls message with nasty char in From");
+}
+$im->done;
+my $bref = $git->cat_file('HEAD');
+like($$bref, qr/^author Ba d \$main::badchars <spammer\@example\.com> /sm,
+ 'latest commit accepted by spammer');
+$git->qx(qw(fsck --no-progress --strict));
+is($?, 0, 'fsck reported no errors');
+$main::badchars = undef;
+