# git-config will operate on this (and rename on success):
my ($fh, $pi_config_tmp) = tempfile('pi-init-XXXXXXXX', DIR => $dir);
+my $cfg_tmp = UnlinkMe->new($pi_config_tmp);
# Now, we grab another lock to use git-config(1) locking, so it won't
# wait on the lock, unlike some of our internal flock()-based locks.
rename $pi_config_tmp, $pi_config or
die "failed to rename `$pi_config_tmp' to `$pi_config': $!\n";
+delete $cfg_tmp->{file};
$auto_unlink->DESTROY;
package UnlinkMe;
'-init did not unlink lock on failure');
}
{
+ my $env = { PI_DIR => "$tmpdir/.public-inbox/" };
my $rdr = { 2 => \(my $err = '') };
my $cmd = [ '-init', 'alist', "$tmpdir/a\nlist",
qw(http://example.com/alist alist@example.com) ];
- ok(!run_script($cmd, undef, $rdr),
+ ok(!run_script($cmd, $env, $rdr),
'public-inbox-init rejects LF in inboxdir');
like($err, qr/`\\n' not allowed in `/s, 'reported \\n');
+ is_deeply([glob("$tmpdir/.public-inbox/pi-init-*")], [],
+ 'no junk files left behind');
}
SKIP: {