-my $ibx = {
- inboxdir => "$tmpdir/v1",
- name => 'test-v1',
- -primary_address => 'test@example.com',
-};
-
-PublicInbox::Import::init_bare($ibx->{inboxdir});
-ok(umask(077), 'set restrictive umask');
-xsys_e(qw(git) , "--git-dir=$ibx->{inboxdir}",
- qw(config core.sharedRepository 0644));
-$ibx = PublicInbox::Inbox->new($ibx);
-my $im = PublicInbox::Import->new($ibx->git, undef, undef, $ibx);
-my $mime = PublicInbox::Eml->new(<<'EOF');
+my $ibx = create_inbox 'v1', indexlevel => 'medium', tmpdir => "$tmpdir/v1",
+ pre_cb => sub {
+ my ($inboxdir) = @_;
+ PublicInbox::Import::init_bare($inboxdir);
+ xsys_e(qw(git) , "--git-dir=$inboxdir",
+ qw(config core.sharedRepository 0644));
+ }, sub {
+ my ($im, $ibx) = @_;
+ $im->done;
+ umask(077) or BAIL_OUT "umask: $!";
+ $_[0] = $im = $ibx->importer(0);
+ my $eml = PublicInbox::Eml->new(<<'EOF');