-# n.b. message may be cross-posted to multiple public-inboxes
-foreach my $recipient (keys %dests) {
- my $dst = $pi_config->lookup($recipient) or next;
- my $git_dir = $dst->{mainrepo} or next;
- my ($out, $err) = ("", "");
- my $git = PublicInbox::Git->new($git_dir);
- # We do not touch GIT_COMMITTER_* env here so we can track
- # who trained the message.
- my $name = $ENV{GIT_COMMITTER_NAME} || $dst->{inbox};
- my $email = $ENV{GIT_COMMITTER_EMAIL} || $recipient;
- my $im = PublicInbox::Import->new($git, $name, $email);
+ # n.b. message may be cross-posted to multiple public-inboxes
+ while (my ($addr, $dst) = each %dests) {
+ next unless ref($dst);
+ # We do not touch GIT_COMMITTER_* env here so we can track
+ # who trained the message.
+ $dst->{name} = $ENV{GIT_COMMITTER_NAME} || $dst->{name};
+ $dst->{-primary_address} = $ENV{GIT_COMMITTER_EMAIL} || $addr;
+ $dst = PublicInbox::InboxWritable->new($dst);
+ my $im = $dst->importer(0);