about summary refs log tree commit homepage
path: root/t/init.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-01 01:15:07 +0000
committerEric Wong <e@80x24.org>2020-09-02 08:54:02 +0000
commit4c2bdcca098792bf1c7fb19d7779d05c436a2f78 (patch)
tree83c1a5ee5539e4d68921f024e068797f8abaa158 /t/init.t
parentff1ceab79e0a9a4ad21e03d8d2eae15dee8c35c7 (diff)
downloadpublic-inbox-4c2bdcca098792bf1c7fb19d7779d05c436a2f78.tar.gz
Following "git init" as an example, we'll create every parent
path up to the one specified, instead of attempting to continue
on when Cwd::abs_path returns `undef'.
Diffstat (limited to 't/init.t')
-rw-r--r--t/init.t12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/init.t b/t/init.t
index a5a9debc..dba59231 100644
--- a/t/init.t
+++ b/t/init.t
@@ -59,6 +59,18 @@ sub quiet_fail {
         like($err, qr/`\\n' not allowed in `/s, 'reported \\n');
         is_deeply([glob("$tmpdir/.public-inbox/pi-init-*")], [],
                 'no junk files left behind');
+
+        # "git init" does this, too
+        $cmd = [ '-init', 'deep-non-existent', "$tmpdir/a/b/c/d",
+                   qw(http://example.com/abcd abcd@example.com) ];
+        $err = '';
+        ok(run_script($cmd, $env, $rdr), 'initializes non-existent hierarchy');
+        ok(-d "$tmpdir/a/b/c/d", 'directory created');
+        open my $fh, '>', "$tmpdir/d" or BAIL_OUT "open: $!";
+        close $fh;
+        $cmd = [ '-init', 'd-f-conflict', "$tmpdir/d/f/conflict",
+                   qw(http://example.com/conflict onflict@example.com) ];
+        ok(!run_script($cmd, $env, $rdr), 'fails on D/F conflict');
 }
 
 SKIP: {