unit-tests: do not mistake `.pdb` files for being executable
[git.git] / t / t6030-bisect-porcelain.sh
blobfb01bd6abce2c815b6f50f75e27e2c8f567cf09c
1 #!/bin/sh
3 # Copyright (c) 2007 Christian Couder
5 test_description='Tests git bisect functionality'
7 exec </dev/null
9 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
12 . ./test-lib.sh
14 add_line_into_file()
16 _line=$1
17 _file=$2
19 if [ -f "$_file" ]; then
20 echo "$_line" >> $_file || return $?
21 MSG="Add <$_line> into <$_file>."
22 else
23 echo "$_line" > $_file || return $?
24 git add $_file || return $?
25 MSG="Create file <$_file> with <$_line> inside."
28 test_tick
29 git commit --quiet -m "$MSG" $_file
32 HASH1=
33 HASH2=
34 HASH3=
35 HASH4=
37 test_bisect_usage () {
38 local code="$1" &&
39 shift &&
40 cat >expect &&
41 test_expect_code $code "$@" >out 2>actual &&
42 test_must_be_empty out &&
43 test_cmp expect actual
46 test_expect_success 'bisect usage' "
47 test_bisect_usage 1 git bisect reset extra1 extra2 <<-\EOF &&
48 error: 'git bisect reset' requires either no argument or a commit
49 EOF
50 test_bisect_usage 1 git bisect terms extra1 extra2 <<-\EOF &&
51 error: 'git bisect terms' requires 0 or 1 argument
52 EOF
53 test_bisect_usage 1 git bisect next extra1 <<-\EOF &&
54 error: 'git bisect next' requires 0 arguments
55 EOF
56 test_bisect_usage 1 git bisect log extra1 <<-\EOF &&
57 error: We are not bisecting.
58 EOF
59 test_bisect_usage 1 git bisect replay <<-\EOF &&
60 error: no logfile given
61 EOF
62 test_bisect_usage 1 git bisect run <<-\EOF
63 error: 'git bisect run' failed: no command provided.
64 EOF
67 test_expect_success 'set up basic repo with 1 file (hello) and 4 commits' '
68 add_line_into_file "1: Hello World" hello &&
69 HASH1=$(git rev-parse --verify HEAD) &&
70 add_line_into_file "2: A new day for git" hello &&
71 HASH2=$(git rev-parse --verify HEAD) &&
72 add_line_into_file "3: Another new day for git" hello &&
73 HASH3=$(git rev-parse --verify HEAD) &&
74 add_line_into_file "4: Ciao for now" hello &&
75 HASH4=$(git rev-parse --verify HEAD)
78 test_expect_success 'bisect starts with only one bad' '
79 git bisect reset &&
80 git bisect start &&
81 git bisect bad $HASH4 &&
82 git bisect next
85 test_expect_success 'bisect does not start with only one good' '
86 git bisect reset &&
87 git bisect start &&
88 git bisect good $HASH1 &&
89 test_must_fail git bisect next
92 test_expect_success 'bisect start with one bad and good' '
93 git bisect reset &&
94 git bisect start &&
95 git bisect good $HASH1 &&
96 git bisect bad $HASH4 &&
97 git bisect next
100 test_expect_success 'bisect fails if given any junk instead of revs' '
101 git bisect reset &&
102 test_must_fail git bisect start foo $HASH1 -- &&
103 test_must_fail git bisect start $HASH4 $HASH1 bar -- &&
104 test -z "$(git for-each-ref "refs/bisect/*")" &&
105 test -z "$(ls .git/BISECT_* 2>/dev/null)" &&
106 git bisect start &&
107 test_must_fail git bisect good foo $HASH1 &&
108 test_must_fail git bisect good $HASH1 bar &&
109 test_must_fail git bisect bad frotz &&
110 test_must_fail git bisect bad $HASH3 $HASH4 &&
111 test_must_fail git bisect skip bar $HASH3 &&
112 test_must_fail git bisect skip $HASH1 foo &&
113 test -z "$(git for-each-ref "refs/bisect/*")" &&
114 git bisect good $HASH1 &&
115 git bisect bad $HASH4
118 test_expect_success 'bisect start without -- takes unknown arg as pathspec' '
119 git bisect reset &&
120 git bisect start foo bar &&
121 grep foo ".git/BISECT_NAMES" &&
122 grep bar ".git/BISECT_NAMES"
125 test_expect_success 'bisect reset: back in a branch checked out also elsewhere' '
126 echo "shared" > branch.expect &&
127 test_bisect_reset() {
128 git -C $1 bisect start &&
129 git -C $1 bisect good $HASH1 &&
130 git -C $1 bisect bad $HASH3 &&
131 git -C $1 bisect reset &&
132 git -C $1 branch --show-current > branch.output &&
133 cmp branch.expect branch.output
134 } &&
135 test_when_finished "
136 git worktree remove wt1 &&
137 git worktree remove wt2 &&
138 git branch -d shared
139 " &&
140 git worktree add wt1 -b shared &&
141 git worktree add wt2 -f shared &&
142 # we test in both worktrees to ensure that works
143 # as expected with "first" and "next" worktrees
144 test_bisect_reset wt1 &&
145 test_bisect_reset wt2
148 test_expect_success 'bisect reset: back in the main branch' '
149 git bisect reset &&
150 echo "* main" > branch.expect &&
151 git branch > branch.output &&
152 cmp branch.expect branch.output
155 test_expect_success 'bisect reset: back in another branch' '
156 git checkout -b other &&
157 git bisect start &&
158 git bisect good $HASH1 &&
159 git bisect bad $HASH3 &&
160 git bisect reset &&
161 echo " main" > branch.expect &&
162 echo "* other" >> branch.expect &&
163 git branch > branch.output &&
164 cmp branch.expect branch.output
167 test_expect_success 'bisect reset when not bisecting' '
168 git bisect reset &&
169 git branch > branch.output &&
170 cmp branch.expect branch.output
173 test_expect_success 'bisect reset removes packed refs' '
174 git bisect reset &&
175 git bisect start &&
176 git bisect good $HASH1 &&
177 git bisect bad $HASH3 &&
178 git pack-refs --all --prune &&
179 git bisect next &&
180 git bisect reset &&
181 test -z "$(git for-each-ref "refs/bisect/*")" &&
182 test -z "$(git for-each-ref "refs/heads/bisect")"
185 test_expect_success 'bisect reset removes bisect state after --no-checkout' '
186 git bisect reset &&
187 git bisect start --no-checkout &&
188 git bisect good $HASH1 &&
189 git bisect bad $HASH3 &&
190 git bisect next &&
191 git bisect reset &&
192 test -z "$(git for-each-ref "refs/bisect/*")" &&
193 test -z "$(git for-each-ref "refs/heads/bisect")" &&
194 test -z "$(git for-each-ref "BISECT_HEAD")"
197 test_expect_success 'bisect start: back in good branch' '
198 git branch > branch.output &&
199 grep "* other" branch.output > /dev/null &&
200 git bisect start $HASH4 $HASH1 -- &&
201 git bisect good &&
202 git bisect start $HASH4 $HASH1 -- &&
203 git bisect bad &&
204 git bisect reset &&
205 git branch > branch.output &&
206 grep "* other" branch.output > /dev/null
209 test_expect_success 'bisect start: no ".git/BISECT_START" created if junk rev' '
210 git bisect reset &&
211 test_must_fail git bisect start $HASH4 foo -- &&
212 git branch > branch.output &&
213 grep "* other" branch.output > /dev/null &&
214 test_path_is_missing .git/BISECT_START
217 test_expect_success 'bisect start: existing ".git/BISECT_START" not modified if junk rev' '
218 git bisect start $HASH4 $HASH1 -- &&
219 git bisect good &&
220 cp .git/BISECT_START saved &&
221 test_must_fail git bisect start $HASH4 foo -- &&
222 git branch > branch.output &&
223 test_i18ngrep "* (no branch, bisect started on other)" branch.output > /dev/null &&
224 test_cmp saved .git/BISECT_START
226 test_expect_success 'bisect start: no ".git/BISECT_START" if mistaken rev' '
227 git bisect start $HASH4 $HASH1 -- &&
228 git bisect good &&
229 test_must_fail git bisect start $HASH1 $HASH4 -- &&
230 git branch > branch.output &&
231 grep "* other" branch.output > /dev/null &&
232 test_path_is_missing .git/BISECT_START
235 test_expect_success 'bisect start: no ".git/BISECT_START" if checkout error' '
236 echo "temp stuff" > hello &&
237 test_must_fail git bisect start $HASH4 $HASH1 -- &&
238 git branch &&
239 git branch > branch.output &&
240 grep "* other" branch.output > /dev/null &&
241 test_path_is_missing .git/BISECT_START &&
242 test -z "$(git for-each-ref "refs/bisect/*")" &&
243 git checkout HEAD hello
246 # $HASH1 is good, $HASH4 is bad, we skip $HASH3
247 # but $HASH2 is bad,
248 # so we should find $HASH2 as the first bad commit
249 test_expect_success 'bisect skip: successful result' '
250 test_when_finished git bisect reset &&
251 git bisect reset &&
252 git bisect start $HASH4 $HASH1 &&
253 git bisect skip &&
254 git bisect bad > my_bisect_log.txt &&
255 grep "$HASH2 is the first bad commit" my_bisect_log.txt
258 # $HASH1 is good, $HASH4 is bad, we skip $HASH3 and $HASH2
259 # so we should not be able to tell the first bad commit
260 # among $HASH2, $HASH3 and $HASH4
261 test_expect_success 'bisect skip: cannot tell between 3 commits' '
262 test_when_finished git bisect reset &&
263 git bisect start $HASH4 $HASH1 &&
264 git bisect skip &&
265 test_expect_code 2 git bisect skip >my_bisect_log.txt &&
266 grep "first bad commit could be any of" my_bisect_log.txt &&
267 ! grep $HASH1 my_bisect_log.txt &&
268 grep $HASH2 my_bisect_log.txt &&
269 grep $HASH3 my_bisect_log.txt &&
270 grep $HASH4 my_bisect_log.txt
273 # $HASH1 is good, $HASH4 is bad, we skip $HASH3
274 # but $HASH2 is good,
275 # so we should not be able to tell the first bad commit
276 # among $HASH3 and $HASH4
277 test_expect_success 'bisect skip: cannot tell between 2 commits' '
278 test_when_finished git bisect reset &&
279 git bisect start $HASH4 $HASH1 &&
280 git bisect skip &&
281 test_expect_code 2 git bisect good >my_bisect_log.txt &&
282 grep "first bad commit could be any of" my_bisect_log.txt &&
283 ! grep $HASH1 my_bisect_log.txt &&
284 ! grep $HASH2 my_bisect_log.txt &&
285 grep $HASH3 my_bisect_log.txt &&
286 grep $HASH4 my_bisect_log.txt
289 # $HASH1 is good, $HASH4 is both skipped and bad, we skip $HASH3
290 # and $HASH2 is good,
291 # so we should not be able to tell the first bad commit
292 # among $HASH3 and $HASH4
293 test_expect_success 'bisect skip: with commit both bad and skipped' '
294 test_when_finished git bisect reset &&
295 git bisect start &&
296 git bisect skip &&
297 git bisect bad &&
298 git bisect good $HASH1 &&
299 git bisect skip &&
300 test_expect_code 2 git bisect good >my_bisect_log.txt &&
301 grep "first bad commit could be any of" my_bisect_log.txt &&
302 ! grep $HASH1 my_bisect_log.txt &&
303 ! grep $HASH2 my_bisect_log.txt &&
304 grep $HASH3 my_bisect_log.txt &&
305 grep $HASH4 my_bisect_log.txt
308 test_bisect_run_args () {
309 test_when_finished "rm -f run.sh actual" &&
310 >actual &&
311 cat >expect.args &&
312 cat <&6 >expect.out &&
313 cat <&7 >expect.err &&
314 write_script run.sh <<-\EOF &&
315 while test $# != 0
317 echo "<$1>" &&
318 shift
319 done >actual.args
322 test_when_finished "git bisect reset" &&
323 git bisect start &&
324 git bisect good $HASH1 &&
325 git bisect bad $HASH4 &&
326 git bisect run ./run.sh $@ >actual.out.raw 2>actual.err &&
327 # Prune just the log output
328 sed -n \
329 -e '/^Author:/d' \
330 -e '/^Date:/d' \
331 -e '/^$/d' \
332 -e '/^commit /d' \
333 -e '/^ /d' \
334 -e 'p' \
335 <actual.out.raw >actual.out &&
336 test_cmp expect.out actual.out &&
337 test_cmp expect.err actual.err &&
338 test_cmp expect.args actual.args
341 test_expect_success 'git bisect run: args, stdout and stderr with no arguments' "
342 test_bisect_run_args <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
343 EOF_ARGS
344 running './run.sh'
345 $HASH4 is the first bad commit
346 bisect found first bad commit
347 EOF_OUT
348 EOF_ERR
351 test_expect_success 'git bisect run: args, stdout and stderr: "--" argument' "
352 test_bisect_run_args -- <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
353 <-->
354 EOF_ARGS
355 running './run.sh' '--'
356 $HASH4 is the first bad commit
357 bisect found first bad commit
358 EOF_OUT
359 EOF_ERR
362 test_expect_success 'git bisect run: args, stdout and stderr: "--log foo --no-log bar" arguments' "
363 test_bisect_run_args --log foo --no-log bar <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
364 <--log>
365 <foo>
366 <--no-log>
367 <bar>
368 EOF_ARGS
369 running './run.sh' '--log' 'foo' '--no-log' 'bar'
370 $HASH4 is the first bad commit
371 bisect found first bad commit
372 EOF_OUT
373 EOF_ERR
376 test_expect_success 'git bisect run: args, stdout and stderr: "--bisect-start" argument' "
377 test_bisect_run_args --bisect-start <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
378 <--bisect-start>
379 EOF_ARGS
380 running './run.sh' '--bisect-start'
381 $HASH4 is the first bad commit
382 bisect found first bad commit
383 EOF_OUT
384 EOF_ERR
387 test_expect_success 'git bisect run: negative exit code' "
388 write_script fail.sh <<-'EOF' &&
389 exit 255
391 cat <<-'EOF' >expect &&
392 bisect run failed: exit code -1 from './fail.sh' is < 0 or >= 128
394 test_when_finished 'git bisect reset' &&
395 git bisect start &&
396 git bisect good $HASH1 &&
397 git bisect bad $HASH4 &&
398 ! git bisect run ./fail.sh 2>err &&
399 sed -En 's/.*(bisect.*code) (-?[0-9]+) (from.*)/\1 -1 \3/p' err >actual &&
400 test_cmp expect actual
403 test_expect_success 'git bisect run: unable to verify on good' "
404 write_script fail.sh <<-'EOF' &&
405 head=\$(git rev-parse --verify HEAD)
406 good=\$(git rev-parse --verify $HASH1)
407 if test "\$head" = "\$good"
408 then
409 exit 255
410 else
411 exit 127
414 cat <<-'EOF' >expect &&
415 unable to verify './fail.sh' on good revision
417 test_when_finished 'git bisect reset' &&
418 git bisect start &&
419 git bisect good $HASH1 &&
420 git bisect bad $HASH4 &&
421 ! git bisect run ./fail.sh 2>err &&
422 sed -n 's/.*\(unable to verify.*\)/\1/p' err >actual &&
423 test_cmp expect actual
426 # We want to automatically find the commit that
427 # added "Another" into hello.
428 test_expect_success '"git bisect run" simple case' '
429 write_script test_script.sh <<-\EOF &&
430 ! grep Another hello >/dev/null
432 git bisect start &&
433 git bisect good $HASH1 &&
434 git bisect bad $HASH4 &&
435 git bisect run ./test_script.sh >my_bisect_log.txt &&
436 grep "$HASH3 is the first bad commit" my_bisect_log.txt &&
437 git bisect reset
440 # We want to make sure no arguments has been eaten
441 test_expect_success '"git bisect run" simple case' '
442 git bisect start &&
443 git bisect good $HASH1 &&
444 git bisect bad $HASH4 &&
445 git bisect run printf "%s %s\n" reset --bisect-skip >my_bisect_log.txt &&
446 grep -e "reset --bisect-skip" my_bisect_log.txt &&
447 git bisect reset
450 # We want to automatically find the commit that
451 # added "Ciao" into hello.
452 test_expect_success '"git bisect run" with more complex "git bisect start"' '
453 write_script test_script.sh <<-\EOF &&
454 ! grep Ciao hello >/dev/null
456 git bisect start $HASH4 $HASH1 &&
457 git bisect run ./test_script.sh >my_bisect_log.txt &&
458 grep "$HASH4 is the first bad commit" my_bisect_log.txt &&
459 git bisect reset
462 test_expect_success 'bisect run accepts exit code 126 as bad' '
463 test_when_finished "git bisect reset" &&
464 write_script test_script.sh <<-\EOF &&
465 ! grep Another hello || exit 126 >/dev/null
467 git bisect start &&
468 git bisect good $HASH1 &&
469 git bisect bad $HASH4 &&
470 git bisect run ./test_script.sh >my_bisect_log.txt &&
471 grep "$HASH3 is the first bad commit" my_bisect_log.txt
474 test_expect_success POSIXPERM 'bisect run fails with non-executable test script' '
475 test_when_finished "git bisect reset" &&
476 >not-executable.sh &&
477 chmod -x not-executable.sh &&
478 git bisect start &&
479 git bisect good $HASH1 &&
480 git bisect bad $HASH4 &&
481 test_must_fail git bisect run ./not-executable.sh >my_bisect_log.txt &&
482 ! grep "is the first bad commit" my_bisect_log.txt
485 test_expect_success 'bisect run accepts exit code 127 as bad' '
486 test_when_finished "git bisect reset" &&
487 write_script test_script.sh <<-\EOF &&
488 ! grep Another hello || exit 127 >/dev/null
490 git bisect start &&
491 git bisect good $HASH1 &&
492 git bisect bad $HASH4 &&
493 git bisect run ./test_script.sh >my_bisect_log.txt &&
494 grep "$HASH3 is the first bad commit" my_bisect_log.txt
497 test_expect_success 'bisect run fails with missing test script' '
498 test_when_finished "git bisect reset" &&
499 rm -f does-not-exist.sh &&
500 git bisect start &&
501 git bisect good $HASH1 &&
502 git bisect bad $HASH4 &&
503 test_must_fail git bisect run ./does-not-exist.sh >my_bisect_log.txt &&
504 ! grep "is the first bad commit" my_bisect_log.txt
507 # $HASH1 is good, $HASH5 is bad, we skip $HASH3
508 # but $HASH4 is good,
509 # so we should find $HASH5 as the first bad commit
510 HASH5=
511 test_expect_success 'bisect skip: add line and then a new test' '
512 add_line_into_file "5: Another new line." hello &&
513 HASH5=$(git rev-parse --verify HEAD) &&
514 git bisect start $HASH5 $HASH1 &&
515 git bisect skip &&
516 git bisect good > my_bisect_log.txt &&
517 grep "$HASH5 is the first bad commit" my_bisect_log.txt &&
518 git bisect log > log_to_replay.txt &&
519 git bisect reset
522 test_expect_success 'bisect skip and bisect replay' '
523 git bisect replay log_to_replay.txt > my_bisect_log.txt &&
524 grep "$HASH5 is the first bad commit" my_bisect_log.txt &&
525 git bisect reset
528 HASH6=
529 test_expect_success 'bisect run & skip: cannot tell between 2' '
530 add_line_into_file "6: Yet a line." hello &&
531 HASH6=$(git rev-parse --verify HEAD) &&
532 write_script test_script.sh <<-\EOF &&
533 sed -ne \$p hello | grep Ciao >/dev/null && exit 125
534 ! grep line hello >/dev/null
536 git bisect start $HASH6 $HASH1 &&
537 test_expect_code 2 git bisect run ./test_script.sh >my_bisect_log.txt &&
538 grep "first bad commit could be any of" my_bisect_log.txt &&
539 ! grep $HASH3 my_bisect_log.txt &&
540 ! grep $HASH6 my_bisect_log.txt &&
541 grep $HASH4 my_bisect_log.txt &&
542 grep $HASH5 my_bisect_log.txt
545 HASH7=
546 test_expect_success 'bisect run & skip: find first bad' '
547 git bisect reset &&
548 add_line_into_file "7: Should be the last line." hello &&
549 HASH7=$(git rev-parse --verify HEAD) &&
550 write_script test_script.sh <<-\EOF &&
551 sed -ne \$p hello | grep Ciao >/dev/null && exit 125
552 sed -ne \$p hello | grep day >/dev/null && exit 125
553 ! grep Yet hello >/dev/null
555 git bisect start $HASH7 $HASH1 &&
556 git bisect run ./test_script.sh >my_bisect_log.txt &&
557 grep "$HASH6 is the first bad commit" my_bisect_log.txt
560 test_expect_success 'bisect skip only one range' '
561 git bisect reset &&
562 git bisect start $HASH7 $HASH1 &&
563 git bisect skip $HASH1..$HASH5 &&
564 test "$HASH6" = "$(git rev-parse --verify HEAD)" &&
565 test_must_fail git bisect bad > my_bisect_log.txt &&
566 grep "first bad commit could be any of" my_bisect_log.txt
569 test_expect_success 'bisect skip many ranges' '
570 git bisect start $HASH7 $HASH1 &&
571 test "$HASH4" = "$(git rev-parse --verify HEAD)" &&
572 git bisect skip $HASH2 $HASH2.. ..$HASH5 &&
573 test "$HASH6" = "$(git rev-parse --verify HEAD)" &&
574 test_must_fail git bisect bad > my_bisect_log.txt &&
575 grep "first bad commit could be any of" my_bisect_log.txt
578 test_expect_success 'bisect starting with a detached HEAD' '
579 git bisect reset &&
580 git checkout main^ &&
581 HEAD=$(git rev-parse --verify HEAD) &&
582 git bisect start &&
583 test $HEAD = $(cat .git/BISECT_START) &&
584 git bisect reset &&
585 test $HEAD = $(git rev-parse --verify HEAD)
588 test_expect_success 'bisect errors out if bad and good are mistaken' '
589 git bisect reset &&
590 test_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&
591 test_i18ngrep "mistook good and bad" rev_list_error &&
592 git bisect reset
595 test_expect_success 'bisect does not create a "bisect" branch' '
596 git bisect reset &&
597 git bisect start $HASH7 $HASH1 &&
598 git branch bisect &&
599 rev_hash4=$(git rev-parse --verify HEAD) &&
600 test "$rev_hash4" = "$HASH4" &&
601 git branch -D bisect &&
602 git bisect good &&
603 git branch bisect &&
604 rev_hash6=$(git rev-parse --verify HEAD) &&
605 test "$rev_hash6" = "$HASH6" &&
606 git bisect good > my_bisect_log.txt &&
607 grep "$HASH7 is the first bad commit" my_bisect_log.txt &&
608 git bisect reset &&
609 rev_hash6=$(git rev-parse --verify bisect) &&
610 test "$rev_hash6" = "$HASH6" &&
611 git branch -D bisect
614 # This creates a "side" branch to test "siblings" cases.
616 # H1-H2-H3-H4-H5-H6-H7 <--other
618 # S5-S6-S7 <--side
620 test_expect_success 'side branch creation' '
621 git bisect reset &&
622 git checkout -b side $HASH4 &&
623 add_line_into_file "5(side): first line on a side branch" hello2 &&
624 SIDE_HASH5=$(git rev-parse --verify HEAD) &&
625 add_line_into_file "6(side): second line on a side branch" hello2 &&
626 SIDE_HASH6=$(git rev-parse --verify HEAD) &&
627 add_line_into_file "7(side): third line on a side branch" hello2 &&
628 SIDE_HASH7=$(git rev-parse --verify HEAD)
631 test_expect_success 'good merge base when good and bad are siblings' '
632 git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
633 test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
634 grep $HASH4 my_bisect_log.txt &&
635 git bisect good > my_bisect_log.txt &&
636 ! grep "merge base must be tested" my_bisect_log.txt &&
637 grep $HASH6 my_bisect_log.txt &&
638 git bisect reset
640 test_expect_success 'skipped merge base when good and bad are siblings' '
641 git bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt &&
642 test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
643 grep $HASH4 my_bisect_log.txt &&
644 git bisect skip > my_bisect_log.txt 2>&1 &&
645 grep "warning" my_bisect_log.txt &&
646 grep $SIDE_HASH6 my_bisect_log.txt &&
647 git bisect reset
650 test_expect_success 'bad merge base when good and bad are siblings' '
651 git bisect start "$HASH7" HEAD > my_bisect_log.txt &&
652 test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
653 grep $HASH4 my_bisect_log.txt &&
654 test_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&
655 test_i18ngrep "merge base $HASH4 is bad" my_bisect_log.txt &&
656 test_i18ngrep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
657 git bisect reset
660 # This creates a few more commits (A and B) to test "siblings" cases
661 # when a good and a bad rev have many merge bases.
663 # We should have the following:
665 # H1-H2-H3-H4-H5-H6-H7
666 # \ \ \
667 # S5-A \
668 # \ \
669 # S6-S7----B
671 # And there A and B have 2 merge bases (S5 and H5) that should be
672 # reported by "git merge-base --all A B".
674 test_expect_success 'many merge bases creation' '
675 git checkout "$SIDE_HASH5" &&
676 git merge -m "merge HASH5 and SIDE_HASH5" "$HASH5" &&
677 A_HASH=$(git rev-parse --verify HEAD) &&
678 git checkout side &&
679 git merge -m "merge HASH7 and SIDE_HASH7" "$HASH7" &&
680 B_HASH=$(git rev-parse --verify HEAD) &&
681 git merge-base --all "$A_HASH" "$B_HASH" > merge_bases.txt &&
682 test_line_count = 2 merge_bases.txt &&
683 grep "$HASH5" merge_bases.txt &&
684 grep "$SIDE_HASH5" merge_bases.txt
687 # We want to automatically find the merge that
688 # added "line" into hello.
689 test_expect_success '"git bisect run --first-parent" simple case' '
690 git rev-list --first-parent $B_HASH ^$HASH4 >first_parent_chain.txt &&
691 write_script test_script.sh <<-\EOF &&
692 grep $(git rev-parse HEAD) first_parent_chain.txt || exit -1
693 ! grep line hello >/dev/null
695 git bisect start --first-parent &&
696 test_path_is_file ".git/BISECT_FIRST_PARENT" &&
697 git bisect good $HASH4 &&
698 git bisect bad $B_HASH &&
699 git bisect run ./test_script.sh >my_bisect_log.txt &&
700 grep "$B_HASH is the first bad commit" my_bisect_log.txt &&
701 git bisect reset &&
702 test_path_is_missing .git/BISECT_FIRST_PARENT
705 test_expect_success 'good merge bases when good and bad are siblings' '
706 git bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt &&
707 test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
708 git bisect good > my_bisect_log2.txt &&
709 test_i18ngrep "merge base must be tested" my_bisect_log2.txt &&
712 grep "$SIDE_HASH5" my_bisect_log.txt &&
713 grep "$HASH5" my_bisect_log2.txt
714 } || {
715 grep "$SIDE_HASH5" my_bisect_log2.txt &&
716 grep "$HASH5" my_bisect_log.txt
718 } &&
719 git bisect reset
722 test_expect_success 'optimized merge base checks' '
723 git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
724 test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
725 grep "$HASH4" my_bisect_log.txt &&
726 git bisect good > my_bisect_log2.txt &&
727 test -f ".git/BISECT_ANCESTORS_OK" &&
728 test "$HASH6" = $(git rev-parse --verify HEAD) &&
729 git bisect bad &&
730 git bisect good "$A_HASH" > my_bisect_log4.txt &&
731 test_i18ngrep "merge base must be tested" my_bisect_log4.txt &&
732 test_path_is_missing ".git/BISECT_ANCESTORS_OK"
735 # This creates another side branch called "parallel" with some files
736 # in some directories, to test bisecting with paths.
738 # We should have the following:
740 # P1-P2-P3-P4-P5-P6-P7
741 # / / /
742 # H1-H2-H3-H4-H5-H6-H7
743 # \ \ \
744 # S5-A \
745 # \ \
746 # S6-S7----B
748 test_expect_success '"parallel" side branch creation' '
749 git bisect reset &&
750 git checkout -b parallel $HASH1 &&
751 mkdir dir1 dir2 &&
752 add_line_into_file "1(para): line 1 on parallel branch" dir1/file1 &&
753 PARA_HASH1=$(git rev-parse --verify HEAD) &&
754 add_line_into_file "2(para): line 2 on parallel branch" dir2/file2 &&
755 PARA_HASH2=$(git rev-parse --verify HEAD) &&
756 add_line_into_file "3(para): line 3 on parallel branch" dir2/file3 &&
757 PARA_HASH3=$(git rev-parse --verify HEAD) &&
758 git merge -m "merge HASH4 and PARA_HASH3" "$HASH4" &&
759 PARA_HASH4=$(git rev-parse --verify HEAD) &&
760 add_line_into_file "5(para): add line on parallel branch" dir1/file1 &&
761 PARA_HASH5=$(git rev-parse --verify HEAD) &&
762 add_line_into_file "6(para): add line on parallel branch" dir2/file2 &&
763 PARA_HASH6=$(git rev-parse --verify HEAD) &&
764 git merge -m "merge HASH7 and PARA_HASH6" "$HASH7" &&
765 PARA_HASH7=$(git rev-parse --verify HEAD)
768 test_expect_success 'restricting bisection on one dir' '
769 git bisect reset &&
770 git bisect start HEAD $HASH1 -- dir1 &&
771 para1=$(git rev-parse --verify HEAD) &&
772 test "$para1" = "$PARA_HASH1" &&
773 git bisect bad > my_bisect_log.txt &&
774 grep "$PARA_HASH1 is the first bad commit" my_bisect_log.txt
777 test_expect_success 'restricting bisection on one dir and a file' '
778 git bisect reset &&
779 git bisect start HEAD $HASH1 -- dir1 hello &&
780 para4=$(git rev-parse --verify HEAD) &&
781 test "$para4" = "$PARA_HASH4" &&
782 git bisect bad &&
783 hash3=$(git rev-parse --verify HEAD) &&
784 test "$hash3" = "$HASH3" &&
785 git bisect good &&
786 hash4=$(git rev-parse --verify HEAD) &&
787 test "$hash4" = "$HASH4" &&
788 git bisect good &&
789 para1=$(git rev-parse --verify HEAD) &&
790 test "$para1" = "$PARA_HASH1" &&
791 git bisect good > my_bisect_log.txt &&
792 grep "$PARA_HASH4 is the first bad commit" my_bisect_log.txt
795 test_expect_success 'skipping away from skipped commit' '
796 git bisect start $PARA_HASH7 $HASH1 &&
797 para4=$(git rev-parse --verify HEAD) &&
798 test "$para4" = "$PARA_HASH4" &&
799 git bisect skip &&
800 hash7=$(git rev-parse --verify HEAD) &&
801 test "$hash7" = "$HASH7" &&
802 git bisect skip &&
803 para3=$(git rev-parse --verify HEAD) &&
804 test "$para3" = "$PARA_HASH3"
807 test_expect_success 'erroring out when using bad path arguments' '
808 test_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&
809 test_i18ngrep "bad path arguments" error.txt
812 test_expect_success 'test bisection on bare repo - --no-checkout specified' '
813 git clone --bare . bare.nocheckout &&
815 cd bare.nocheckout &&
816 git bisect start --no-checkout &&
817 git bisect good $HASH1 &&
818 git bisect bad $HASH4 &&
819 git bisect run eval \
820 "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
821 >../nocheckout.log
822 ) &&
823 grep "$HASH3 is the first bad commit" nocheckout.log
827 test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '
828 git clone --bare . bare.defaulted &&
830 cd bare.defaulted &&
831 git bisect start &&
832 git bisect good $HASH1 &&
833 git bisect bad $HASH4 &&
834 git bisect run eval \
835 "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
836 >../defaulted.log
837 ) &&
838 grep "$HASH3 is the first bad commit" defaulted.log
842 # This creates a broken branch which cannot be checked out because
843 # the tree created has been deleted.
845 # H1-H2-H3-H4-H5-H6-H7 <--other
847 # S5-S6'-S7'-S8'-S9 <--broken
849 # Commits marked with ' have a missing tree.
851 test_expect_success 'broken branch creation' '
852 git bisect reset &&
853 git checkout -b broken $HASH4 &&
854 git tag BROKEN_HASH4 $HASH4 &&
855 add_line_into_file "5(broken): first line on a broken branch" hello2 &&
856 git tag BROKEN_HASH5 &&
857 mkdir missing &&
858 :> missing/MISSING &&
859 git add missing/MISSING &&
860 git commit -m "6(broken): Added file that will be deleted" &&
861 git tag BROKEN_HASH6 &&
862 deleted=$(git rev-parse --verify HEAD:missing) &&
863 add_line_into_file "7(broken): second line on a broken branch" hello2 &&
864 git tag BROKEN_HASH7 &&
865 add_line_into_file "8(broken): third line on a broken branch" hello2 &&
866 git tag BROKEN_HASH8 &&
867 git rm missing/MISSING &&
868 git commit -m "9(broken): Remove missing file" &&
869 git tag BROKEN_HASH9 &&
870 rm .git/objects/$(test_oid_to_path $deleted)
873 echo "" > expected.ok
874 cat > expected.missing-tree.default <<EOF
875 fatal: unable to read tree $deleted
878 test_expect_success 'bisect fails if tree is broken on start commit' '
879 git bisect reset &&
880 test_must_fail git bisect start BROKEN_HASH7 BROKEN_HASH4 2>error.txt &&
881 test_cmp expected.missing-tree.default error.txt
884 test_expect_success 'bisect fails if tree is broken on trial commit' '
885 git bisect reset &&
886 test_must_fail git bisect start BROKEN_HASH9 BROKEN_HASH4 2>error.txt &&
887 git reset --hard broken &&
888 git checkout broken &&
889 test_cmp expected.missing-tree.default error.txt
892 check_same()
894 echo "Checking $1 is the same as $2" &&
895 test_cmp_rev "$1" "$2"
898 test_expect_success 'bisect: --no-checkout - start commit bad' '
899 git bisect reset &&
900 git bisect start BROKEN_HASH7 BROKEN_HASH4 --no-checkout &&
901 check_same BROKEN_HASH6 BISECT_HEAD &&
902 git bisect reset
905 test_expect_success 'bisect: --no-checkout - trial commit bad' '
906 git bisect reset &&
907 git bisect start broken BROKEN_HASH4 --no-checkout &&
908 check_same BROKEN_HASH6 BISECT_HEAD &&
909 git bisect reset
912 test_expect_success 'bisect: --no-checkout - target before breakage' '
913 git bisect reset &&
914 git bisect start broken BROKEN_HASH4 --no-checkout &&
915 check_same BROKEN_HASH6 BISECT_HEAD &&
916 git bisect bad BISECT_HEAD &&
917 check_same BROKEN_HASH5 BISECT_HEAD &&
918 git bisect bad BISECT_HEAD &&
919 check_same BROKEN_HASH5 bisect/bad &&
920 git bisect reset
923 test_expect_success 'bisect: --no-checkout - target in breakage' '
924 git bisect reset &&
925 git bisect start broken BROKEN_HASH4 --no-checkout &&
926 check_same BROKEN_HASH6 BISECT_HEAD &&
927 git bisect bad BISECT_HEAD &&
928 check_same BROKEN_HASH5 BISECT_HEAD &&
929 test_must_fail git bisect good BISECT_HEAD &&
930 check_same BROKEN_HASH6 bisect/bad &&
931 git bisect reset
934 test_expect_success 'bisect: --no-checkout - target after breakage' '
935 git bisect reset &&
936 git bisect start broken BROKEN_HASH4 --no-checkout &&
937 check_same BROKEN_HASH6 BISECT_HEAD &&
938 git bisect good BISECT_HEAD &&
939 check_same BROKEN_HASH8 BISECT_HEAD &&
940 test_must_fail git bisect good BISECT_HEAD &&
941 check_same BROKEN_HASH9 bisect/bad &&
942 git bisect reset
945 test_expect_success 'bisect: demonstrate identification of damage boundary' "
946 git bisect reset &&
947 git checkout broken &&
948 git bisect start broken main --no-checkout &&
949 test_must_fail git bisect run \"\$SHELL_PATH\" -c '
950 GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
951 git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
952 git pack-objects --stdout >/dev/null < tmp.\$\$
953 rc=\$?
954 rm -f tmp.\$\$
955 test \$rc = 0' &&
956 check_same BROKEN_HASH6 bisect/bad &&
957 git bisect reset
960 cat > expected.bisect-log <<EOF
961 # bad: [$HASH4] Add <4: Ciao for now> into <hello>.
962 # good: [$HASH2] Add <2: A new day for git> into <hello>.
963 git bisect start '$HASH4' '$HASH2'
964 # good: [$HASH3] Add <3: Another new day for git> into <hello>.
965 git bisect good $HASH3
966 # first bad commit: [$HASH4] Add <4: Ciao for now> into <hello>.
969 test_expect_success 'bisect log: successful result' '
970 git bisect reset &&
971 git bisect start $HASH4 $HASH2 &&
972 git bisect good &&
973 git bisect log >bisect-log.txt &&
974 test_cmp expected.bisect-log bisect-log.txt &&
975 git bisect reset
978 cat > expected.bisect-skip-log <<EOF
979 # bad: [$HASH4] Add <4: Ciao for now> into <hello>.
980 # good: [$HASH2] Add <2: A new day for git> into <hello>.
981 git bisect start '$HASH4' '$HASH2'
982 # skip: [$HASH3] Add <3: Another new day for git> into <hello>.
983 git bisect skip $HASH3
984 # only skipped commits left to test
985 # possible first bad commit: [$HASH4] Add <4: Ciao for now> into <hello>.
986 # possible first bad commit: [$HASH3] Add <3: Another new day for git> into <hello>.
989 test_expect_success 'bisect log: only skip commits left' '
990 git bisect reset &&
991 git bisect start $HASH4 $HASH2 &&
992 test_must_fail git bisect skip &&
993 git bisect log >bisect-skip-log.txt &&
994 test_cmp expected.bisect-skip-log bisect-skip-log.txt &&
995 git bisect reset
998 test_expect_success '"git bisect bad HEAD" behaves as "git bisect bad"' '
999 git checkout parallel &&
1000 git bisect start HEAD $HASH1 &&
1001 git bisect good HEAD &&
1002 git bisect bad HEAD &&
1003 test "$HASH6" = $(git rev-parse --verify HEAD) &&
1004 git bisect reset
1007 test_expect_success 'bisect starts with only one new' '
1008 git bisect reset &&
1009 git bisect start &&
1010 git bisect new $HASH4 &&
1011 git bisect next
1014 test_expect_success 'bisect does not start with only one old' '
1015 git bisect reset &&
1016 git bisect start &&
1017 git bisect old $HASH1 &&
1018 test_must_fail git bisect next
1021 test_expect_success 'bisect start with one new and old' '
1022 git bisect reset &&
1023 git bisect start &&
1024 git bisect old $HASH1 &&
1025 git bisect new $HASH4 &&
1026 git bisect new &&
1027 git bisect new >bisect_result &&
1028 grep "$HASH2 is the first new commit" bisect_result &&
1029 git bisect log >log_to_replay.txt &&
1030 git bisect reset
1033 test_expect_success 'bisect replay with old and new' '
1034 git bisect replay log_to_replay.txt >bisect_result &&
1035 grep "$HASH2 is the first new commit" bisect_result &&
1036 git bisect reset
1039 test_expect_success 'bisect replay with CRLF log' '
1040 append_cr <log_to_replay.txt >log_to_replay_crlf.txt &&
1041 git bisect replay log_to_replay_crlf.txt >bisect_result_crlf &&
1042 grep "$HASH2 is the first new commit" bisect_result_crlf &&
1043 git bisect reset
1046 test_expect_success 'bisect cannot mix old/new and good/bad' '
1047 git bisect start &&
1048 git bisect bad $HASH4 &&
1049 test_must_fail git bisect old $HASH1
1052 test_expect_success 'bisect terms needs 0 or 1 argument' '
1053 git bisect reset &&
1054 test_must_fail git bisect terms only-one &&
1055 test_must_fail git bisect terms 1 2 &&
1056 test_must_fail git bisect terms 2>actual &&
1057 echo "error: no terms defined" >expected &&
1058 test_cmp expected actual
1061 test_expect_success 'bisect terms shows good/bad after start' '
1062 git bisect reset &&
1063 git bisect start HEAD $HASH1 &&
1064 git bisect terms --term-good >actual &&
1065 echo good >expected &&
1066 test_cmp expected actual &&
1067 git bisect terms --term-bad >actual &&
1068 echo bad >expected &&
1069 test_cmp expected actual
1072 test_expect_success 'bisect start with one term1 and term2' '
1073 git bisect reset &&
1074 git bisect start --term-old term2 --term-new term1 &&
1075 git bisect term2 $HASH1 &&
1076 git bisect term1 $HASH4 &&
1077 git bisect term1 &&
1078 git bisect term1 >bisect_result &&
1079 grep "$HASH2 is the first term1 commit" bisect_result &&
1080 git bisect log >log_to_replay.txt &&
1081 git bisect reset
1084 test_expect_success 'bogus command does not start bisect' '
1085 git bisect reset &&
1086 test_must_fail git bisect --bisect-terms 1 2 2>out &&
1087 ! grep "You need to start" out &&
1088 test_must_fail git bisect --bisect-terms 2>out &&
1089 ! grep "You need to start" out &&
1090 grep "git bisect.*visualize" out &&
1091 git bisect reset
1094 test_expect_success 'bisect replay with term1 and term2' '
1095 git bisect replay log_to_replay.txt >bisect_result &&
1096 grep "$HASH2 is the first term1 commit" bisect_result &&
1097 git bisect reset
1100 test_expect_success 'bisect start term1 term2' '
1101 git bisect reset &&
1102 git bisect start --term-new term1 --term-old term2 $HASH4 $HASH1 &&
1103 git bisect term1 &&
1104 git bisect term1 >bisect_result &&
1105 grep "$HASH2 is the first term1 commit" bisect_result &&
1106 git bisect log >log_to_replay.txt &&
1107 git bisect reset
1110 test_expect_success 'bisect cannot mix terms' '
1111 git bisect reset &&
1112 git bisect start --term-good term1 --term-bad term2 $HASH4 $HASH1 &&
1113 test_must_fail git bisect a &&
1114 test_must_fail git bisect b &&
1115 test_must_fail git bisect bad &&
1116 test_must_fail git bisect good &&
1117 test_must_fail git bisect new &&
1118 test_must_fail git bisect old
1121 test_expect_success 'bisect terms rejects invalid terms' '
1122 git bisect reset &&
1123 test_must_fail git bisect start --term-good &&
1124 test_must_fail git bisect start --term-good invalid..term &&
1125 test_must_fail git bisect start --term-bad &&
1126 test_must_fail git bisect terms --term-bad invalid..term &&
1127 test_must_fail git bisect terms --term-good bad &&
1128 test_must_fail git bisect terms --term-good old &&
1129 test_must_fail git bisect terms --term-good skip &&
1130 test_must_fail git bisect terms --term-good reset &&
1131 test_path_is_missing .git/BISECT_TERMS
1134 test_expect_success 'bisect start --term-* does store terms' '
1135 git bisect reset &&
1136 git bisect start --term-bad=one --term-good=two &&
1137 git bisect terms >actual &&
1138 cat <<-EOF >expected &&
1139 Your current terms are two for the old state
1140 and one for the new state.
1142 test_cmp expected actual &&
1143 git bisect terms --term-bad >actual &&
1144 echo one >expected &&
1145 test_cmp expected actual &&
1146 git bisect terms --term-good >actual &&
1147 echo two >expected &&
1148 test_cmp expected actual
1151 test_expect_success 'bisect start takes options and revs in any order' '
1152 git bisect reset &&
1153 git bisect start --term-good one $HASH4 \
1154 --term-good two --term-bad bad-term \
1155 $HASH1 --term-good three -- &&
1156 (git bisect terms --term-bad && git bisect terms --term-good) >actual &&
1157 printf "%s\n%s\n" bad-term three >expected &&
1158 test_cmp expected actual
1161 # Bisect is started with --term-new and --term-old arguments,
1162 # then skip. The HEAD should be changed.
1163 test_expect_success 'bisect skip works with --term*' '
1164 git bisect reset &&
1165 git bisect start --term-new=fixed --term-old=unfixed HEAD $HASH1 &&
1166 hash_skipped_from=$(git rev-parse --verify HEAD) &&
1167 git bisect skip &&
1168 hash_skipped_to=$(git rev-parse --verify HEAD) &&
1169 test "$hash_skipped_from" != "$hash_skipped_to"
1172 test_expect_success 'git bisect reset cleans bisection state properly' '
1173 git bisect reset &&
1174 git bisect start &&
1175 git bisect good $HASH1 &&
1176 git bisect bad $HASH4 &&
1177 git bisect reset &&
1178 test -z "$(git for-each-ref "refs/bisect/*")" &&
1179 test_path_is_missing ".git/BISECT_EXPECTED_REV" &&
1180 test_path_is_missing ".git/BISECT_ANCESTORS_OK" &&
1181 test_path_is_missing ".git/BISECT_LOG" &&
1182 test_path_is_missing ".git/BISECT_RUN" &&
1183 test_path_is_missing ".git/BISECT_TERMS" &&
1184 test_path_is_missing ".git/BISECT_HEAD" &&
1185 test_path_is_missing ".git/BISECT_START"
1188 test_expect_success 'bisect handles annotated tags' '
1189 test_commit commit-one &&
1190 git tag -m foo tag-one &&
1191 test_commit commit-two &&
1192 git tag -m foo tag-two &&
1193 git bisect start &&
1194 git bisect good tag-one &&
1195 git bisect bad tag-two >output &&
1196 bad=$(git rev-parse --verify tag-two^{commit}) &&
1197 grep "$bad is the first bad commit" output
1200 test_expect_success 'bisect run fails with exit code equals or greater than 128' '
1201 write_script test_script.sh <<-\EOF &&
1202 exit 128
1204 test_must_fail git bisect run ./test_script.sh &&
1205 write_script test_script.sh <<-\EOF &&
1206 exit 255
1208 test_must_fail git bisect run ./test_script.sh
1211 test_expect_success 'bisect visualize with a filename with dash and space' '
1212 echo "My test line" >>"./-hello 2" &&
1213 git add -- "./-hello 2" &&
1214 git commit --quiet -m "Add test line" -- "./-hello 2" &&
1215 git bisect visualize -p -- "-hello 2"
1218 test_expect_success 'bisect state output with multiple good commits' '
1219 git bisect reset &&
1220 git bisect start >output &&
1221 grep "waiting for both good and bad commits" output &&
1222 git bisect log >output &&
1223 grep "waiting for both good and bad commits" output &&
1224 git bisect good "$HASH1" >output &&
1225 grep "waiting for bad commit, 1 good commit known" output &&
1226 git bisect log >output &&
1227 grep "waiting for bad commit, 1 good commit known" output &&
1228 git bisect good "$HASH2" >output &&
1229 grep "waiting for bad commit, 2 good commits known" output &&
1230 git bisect log >output &&
1231 grep "waiting for bad commit, 2 good commits known" output
1234 test_expect_success 'bisect state output with bad commit' '
1235 git bisect reset &&
1236 git bisect start >output &&
1237 grep "waiting for both good and bad commits" output &&
1238 git bisect log >output &&
1239 grep "waiting for both good and bad commits" output &&
1240 git bisect bad "$HASH4" >output &&
1241 grep -F "waiting for good commit(s), bad commit known" output &&
1242 git bisect log >output &&
1243 grep -F "waiting for good commit(s), bad commit known" output
1246 test_expect_success 'verify correct error message' '
1247 git bisect reset &&
1248 git bisect start $HASH4 $HASH1 &&
1249 write_script test_script.sh <<-\EOF &&
1250 rm .git/BISECT*
1252 test_must_fail git bisect run ./test_script.sh 2>error &&
1253 grep "git bisect good.*exited with error code" error
1256 test_done