]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/lei-mirror.t
fetch: support --exit-code switch
[public-inbox.git] / t / lei-mirror.t
index 5238b67cef0d51777dca88fbeee00d75b5d307c1..9fdda5aa213901aceae0430bf36a804129254386 100644 (file)
@@ -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');