local $ENV{GIT_COMMITTER_NAME} = eval {
use PublicInbox::MDA;
+ use PublicInbox::Address;
use Encode qw/encode/;
my $mbox = 't/utf8.mbox';
open(my $fh, '<', $mbox) or die "failed to open mbox: $mbox\n";
$msg = Email::MIME->new($msg->simple->as_string);
my $from = $msg->header('From');
- my @from = Email::Address->parse($from);
- my $author = $from[0]->name;
- my $email = $from[0]->address;
- my $date = $msg ->header('Date');
+ my $author = PublicInbox::Address::from_name($from);
+ my ($email) = PublicInbox::Address::emails($from);
+ my $date = $msg->header('Date');
is('Eléanor',
encode('us-ascii', my $tmp = $author, Encode::HTMLCREF),
{
local $ENV{PATH} = $main_path;
run([$mda], \$in);
- local $ENV{GIT_DIR} = $maindir;
- my $rev = `git rev-list HEAD`;
+ my $rev = `git --git-dir=$maindir rev-list HEAD`;
like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
chomp $rev;
- my $cmt = `git cat-file commit $rev`;
+ my $cmt = `git --git-dir=$maindir cat-file commit $rev`;
like($cmt, qr/^author Me <me\@example\.com> 0 \+0000\n/m,
"author info set correctly");
like($cmt, qr/^committer test <test-public\@example\.com>/m,
ok(!-e $failbox, "nothing in PI_EMERGENCY before");
local $ENV{PATH} = $fail_path;
run([$mda], \$in);
- local $ENV{GIT_DIR} = $maindir;
- my @revs = `git rev-list HEAD`;
+ my @revs = `git --git-dir=$maindir rev-list HEAD`;
is(scalar @revs, 1, "bad revision not committed");
ok(-s $failbox > 0, "PI_EMERGENCY is written to");
}
my ($out, $err) = ("", "");
local $ENV{PATH} = $main_path;
run([$mda], \$in, \$out, \$err);
- local $ENV{GIT_DIR} = $maindir;
- my $rev = `git rev-list HEAD`;
+ my $rev = `git --git-dir=$maindir rev-list HEAD`;
chomp $rev;
is($rev, $good_rev, "bad revision not commited ($msg)");
ok(-s $failbox > 0, "PI_EMERGENCY is written to ($msg)");