Skip to content

Commit 4de06fb

Browse files
dschogitster
authored andcommitted
bisect run: fix the error message
In d1bbbe4 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13), we ported the `bisect run` subcommand to C, including the part that prints out an error message when the implicit `git bisect bad` or `git bisect good` failed. However, the error message was supposed to print out whether the state was "good" or "bad", but used a bogus (because non-populated) `args` variable for it. This was fixed in [1], but as of [2] (when `bisect--helper` was changed to the present `bisect-state') the error message still talks about implementation details that should not concern end users. Fix that, and add a regression test to ensure that the intended form of the error message. 1. 80c2e96 (bisect--helper: report actual bisect_state() argument on error, 2022-01-18 2. f37d0bd (bisect: fix output regressions in v2.30.0, 2022-11-10) Helped-by: Elijah Newren <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2f645b3 commit 4de06fb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

builtin/bisect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)
12921292
puts(_("bisect found first bad commit"));
12931293
res = BISECT_OK;
12941294
} else if (res) {
1295-
error(_("bisect run failed: 'bisect-state %s'"
1295+
error(_("bisect run failed: 'git bisect %s'"
12961296
" exited with error code %d"), new_state, res);
12971297
} else {
12981298
continue;

t/t6030-bisect-porcelain.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,4 +1221,14 @@ test_expect_success 'bisect state output with bad commit' '
12211221
grep -F "waiting for good commit(s), bad commit known" output
12221222
'
12231223

1224+
test_expect_success 'verify correct error message' '
1225+
git bisect reset &&
1226+
git bisect start $HASH4 $HASH1 &&
1227+
write_script test_script.sh <<-\EOF &&
1228+
rm .git/BISECT*
1229+
EOF
1230+
test_must_fail git bisect run ./test_script.sh 2>error &&
1231+
grep "git bisect good.*exited with error code" error
1232+
'
1233+
12241234
test_done

0 commit comments

Comments
 (0)