about summary refs log tree commit homepage
path: root/t/lei-mirror.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-15 21:35:55 +0000
committerEric Wong <e@80x24.org>2021-09-15 23:12:51 +0000
commit6393ec8118e7f5481ab476c2d73614c89c64866f (patch)
tree691feeb1756ee9366ba6546d29f5fb03447fcbe8 /t/lei-mirror.t
parentae6cd61cf7cb9988d6e9178dbdeebfb6109e74da (diff)
downloadpublic-inbox-6393ec8118e7f5481ab476c2d73614c89c64866f.tar.gz
As noted in the new manpage entry, this is useful for avoiding
public-inbox-index invocations when there's nothing to update.
We use 127 to match "grok-pull", and also because it doesn't
conflict with any of the current curl(1) exit codes.
Diffstat (limited to 't/lei-mirror.t')
-rw-r--r--t/lei-mirror.t12
1 files changed, 8 insertions, 4 deletions
diff --git a/t/lei-mirror.t b/t/lei-mirror.t
index 5238b67c..9fdda5aa 100644
--- a/t/lei-mirror.t
+++ b/t/lei-mirror.t
@@ -111,12 +111,14 @@ SKIP: {
                 'all.git alternates created');
         ok(-f "$d/t2/manifest.js.gz", 'manifest saved');
         ok(!-e "$d/t2/mirror.done", 'no leftover mirror.done');
-        ok(run_script([qw(-fetch -C), "$d/t2"], undef, $opt),
+        ok(!run_script([qw(-fetch --exit-code -C), "$d/t2"], undef, $opt),
                 '-fetch succeeds w/ manifest.js.gz');
+        is($? >> 8, 127, '--exit-code gave 127');
         unlike($err, qr/git fetch/, 'no fetch done w/ manifest');
         unlink("$d/t2/manifest.js.gz") or xbail "unlink $!";
-        ok(run_script([qw(-fetch -C), "$d/t2"], undef, $opt),
+        ok(!run_script([qw(-fetch --exit-code -C), "$d/t2"], undef, $opt),
                 '-fetch succeeds w/o manifest.js.gz');
+        is($? >> 8, 127, '--exit-code gave 127');
         like($err, qr/git fetch/, 'fetch forced w/o manifest');
 
         ok(run_script([qw(-clone -q -C), $d, "$http/t1"], undef, $opt),
@@ -124,13 +126,15 @@ SKIP: {
         ok(-d "$d/t1", 'v1 cloned');
         ok(!-e "$d/t1/mirror.done", 'no leftover file');
         ok(-f "$d/t1/manifest.js.gz", 'manifest saved');
-        ok(run_script([qw(-fetch -C), "$d/t1"], undef, $opt),
+        ok(!run_script([qw(-fetch --exit-code -C), "$d/t1"], undef, $opt),
                 'fetching v1 works');
+        is($? >> 8, 127, '--exit-code gave 127');
         unlike($err, qr/git fetch/, 'no fetch done w/ manifest');
         unlink("$d/t1/manifest.js.gz") or xbail "unlink $!";
         my $before = [ glob("$d/t1/*") ];
-        ok(run_script([qw(-fetch -C), "$d/t1"], undef, $opt),
+        ok(!run_script([qw(-fetch --exit-code -C), "$d/t1"], undef, $opt),
                 'fetching v1 works w/o manifest.js.gz');
+        is($? >> 8, 127, '--exit-code gave 127');
         unlink("$d/t1/FETCH_HEAD"); # git internal
         like($err, qr/git fetch/, 'no fetch done w/ manifest');
         ok(unlink("$d/t1/manifest.js.gz"), 'manifest created');