diff options
author | René Scharfe <l.s.r@web.de> | 2022-01-18 13:46:32 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-19 09:35:03 -0800 |
commit | 48af1fdee374e205c9774c163fbd4683d1110d11 (patch) | |
tree | 67fa2c2d97c9d387d1ec3d98df1b1bd0361b3868 /t/t6030-bisect-porcelain.sh | |
parent | ba5bb8152c463c9e59600e03913e99144b9673cc (diff) | |
download | git-48af1fdee374e205c9774c163fbd4683d1110d11.tar.gz |
bisect--helper: double-check run command on exit code 126 and 127
When a run command cannot be executed or found, shells return exit code
126 or 127, respectively. Valid run commands are allowed to return
these codes as well to indicate bad revisions, though, for historical
reasons. This means typos can cause bogus bisect runs that go over the
full distance and end up reporting invalid results.
The best solution would be to reserve exit codes 126 and 127, like
71b0251cdd (Bisect run: "skip" current commit if script exit code is
125., 2007-10-26) did for 125, and abort bisect run when we get them.
That might be inconvenient for those who relied on the documentation
stating that 126 and 127 can be used for bad revisions, though.
The workaround used by this patch is to run the command on a known-good
revision and abort if we still get the same error code. This adds one
step to runs with scripts that use exit codes 126 and 127, but keeps
them supported, with one exception: It won't work with commands that
cannot recognize the (manually marked) known-good revision as such.
Run commands that use low exit codes are unaffected. Typos are reported
after executing the missing command twice and three checkouts (the first
step, the known good revision and back to the revision of the first
step).
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6030-bisect-porcelain.sh')
-rwxr-xr-x | t/t6030-bisect-porcelain.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index fc18796517..5382e5d216 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -290,7 +290,7 @@ test_expect_success 'bisect run accepts exit code 126 as bad' ' grep "$HASH3 is the first bad commit" my_bisect_log.txt ' -test_expect_failure POSIXPERM 'bisect run fails with non-executable test script' ' +test_expect_success POSIXPERM 'bisect run fails with non-executable test script' ' test_when_finished "git bisect reset" && >not-executable.sh && chmod -x not-executable.sh && @@ -313,7 +313,7 @@ test_expect_success 'bisect run accepts exit code 127 as bad' ' grep "$HASH3 is the first bad commit" my_bisect_log.txt ' -test_expect_failure 'bisect run fails with missing test script' ' +test_expect_success 'bisect run fails with missing test script' ' test_when_finished "git bisect reset" && rm -f does-not-exist.sh && git bisect start && |