about summary refs log tree commit homepage
path: root/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
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')
-rw-r--r--t/lei-mirror.t12
-rw-r--r--t/v2mirror.t3
2 files changed, 10 insertions, 5 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');
diff --git a/t/v2mirror.t b/t/v2mirror.t
index 54ad6945..3df5d053 100644
--- a/t/v2mirror.t
+++ b/t/v2mirror.t
@@ -98,8 +98,9 @@ $ibx->cleanup;
 my @new_epochs;
 my $fetch_each_epoch = sub {
         my %before = map { $_ => 1 } glob("$tmpdir/m/git/*");
-        run_script([qw(-fetch -q)], undef, {-C => "$tmpdir/m"}) or
+        run_script([qw(-fetch --exit-code -q)], undef, {-C => "$tmpdir/m"}) or
                 xbail '-fetch fail';
+        is($?, 0, '--exit-code 0 after fetch updated');
         my @after = grep { !$before{$_} } glob("$tmpdir/m/git/*");
         push @new_epochs, @after;
 };