Documentation/RelNotes/2.45.0.txt: fix typo
[git.git] / t / t6030-bisect-porcelain.sh
blobcdc02706404b34b17b29692d72d97fab7eba58b1
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 cleans up even when not bisecting' '
174 echo garbage >.git/BISECT_LOG &&
175 git bisect reset &&
176 test_path_is_missing .git/BISECT_LOG
179 test_expect_success 'bisect reset removes packed refs' '
180 git bisect reset &&
181 git bisect start &&
182 git bisect good $HASH1 &&
183 git bisect bad $HASH3 &&
184 git pack-refs --all --prune &&
185 git bisect next &&
186 git bisect reset &&
187 test -z "$(git for-each-ref "refs/bisect/*")" &&
188 test -z "$(git for-each-ref "refs/heads/bisect")"
191 test_expect_success 'bisect reset removes bisect state after --no-checkout' '
192 git bisect reset &&
193 git bisect start --no-checkout &&
194 git bisect good $HASH1 &&
195 git bisect bad $HASH3 &&
196 git bisect next &&
197 git bisect reset &&
198 test -z "$(git for-each-ref "refs/bisect/*")" &&
199 test -z "$(git for-each-ref "refs/heads/bisect")" &&
200 test -z "$(git for-each-ref "BISECT_HEAD")"
203 test_expect_success 'bisect start: back in good branch' '
204 git branch > branch.output &&
205 grep "* other" branch.output > /dev/null &&
206 git bisect start $HASH4 $HASH1 -- &&
207 git bisect good &&
208 git bisect start $HASH4 $HASH1 -- &&
209 git bisect bad &&
210 git bisect reset &&
211 git branch > branch.output &&
212 grep "* other" branch.output > /dev/null
215 test_expect_success 'bisect start: no ".git/BISECT_START" created if junk rev' '
216 git bisect reset &&
217 test_must_fail git bisect start $HASH4 foo -- &&
218 git branch > branch.output &&
219 grep "* other" branch.output > /dev/null &&
220 test_path_is_missing .git/BISECT_START
223 test_expect_success 'bisect start: existing ".git/BISECT_START" not modified if junk rev' '
224 git bisect start $HASH4 $HASH1 -- &&
225 git bisect good &&
226 cp .git/BISECT_START saved &&
227 test_must_fail git bisect start $HASH4 foo -- &&
228 git branch > branch.output &&
229 test_grep "* (no branch, bisect started on other)" branch.output > /dev/null &&
230 test_cmp saved .git/BISECT_START
232 test_expect_success 'bisect start: no ".git/BISECT_START" if mistaken rev' '
233 git bisect start $HASH4 $HASH1 -- &&
234 git bisect good &&
235 test_must_fail git bisect start $HASH1 $HASH4 -- &&
236 git branch > branch.output &&
237 grep "* other" branch.output > /dev/null &&
238 test_path_is_missing .git/BISECT_START
241 test_expect_success 'bisect start: no ".git/BISECT_START" if checkout error' '
242 echo "temp stuff" > hello &&
243 test_must_fail git bisect start $HASH4 $HASH1 -- &&
244 git branch &&
245 git branch > branch.output &&
246 grep "* other" branch.output > /dev/null &&
247 test_path_is_missing .git/BISECT_START &&
248 test -z "$(git for-each-ref "refs/bisect/*")" &&
249 git checkout HEAD hello
252 # $HASH1 is good, $HASH4 is bad, we skip $HASH3
253 # but $HASH2 is bad,
254 # so we should find $HASH2 as the first bad commit
255 test_expect_success 'bisect skip: successful result' '
256 test_when_finished git bisect reset &&
257 git bisect reset &&
258 git bisect start $HASH4 $HASH1 &&
259 git bisect skip &&
260 git bisect bad > my_bisect_log.txt &&
261 grep "$HASH2 is the first bad commit" my_bisect_log.txt
264 # $HASH1 is good, $HASH4 is bad, we skip $HASH3 and $HASH2
265 # so we should not be able to tell the first bad commit
266 # among $HASH2, $HASH3 and $HASH4
267 test_expect_success 'bisect skip: cannot tell between 3 commits' '
268 test_when_finished git bisect reset &&
269 git bisect start $HASH4 $HASH1 &&
270 git bisect skip &&
271 test_expect_code 2 git bisect skip >my_bisect_log.txt &&
272 grep "first bad commit could be any of" my_bisect_log.txt &&
273 ! grep $HASH1 my_bisect_log.txt &&
274 grep $HASH2 my_bisect_log.txt &&
275 grep $HASH3 my_bisect_log.txt &&
276 grep $HASH4 my_bisect_log.txt
279 # $HASH1 is good, $HASH4 is bad, we skip $HASH3
280 # but $HASH2 is good,
281 # so we should not be able to tell the first bad commit
282 # among $HASH3 and $HASH4
283 test_expect_success 'bisect skip: cannot tell between 2 commits' '
284 test_when_finished git bisect reset &&
285 git bisect start $HASH4 $HASH1 &&
286 git bisect skip &&
287 test_expect_code 2 git bisect good >my_bisect_log.txt &&
288 grep "first bad commit could be any of" my_bisect_log.txt &&
289 ! grep $HASH1 my_bisect_log.txt &&
290 ! grep $HASH2 my_bisect_log.txt &&
291 grep $HASH3 my_bisect_log.txt &&
292 grep $HASH4 my_bisect_log.txt
295 # $HASH1 is good, $HASH4 is both skipped and bad, we skip $HASH3
296 # and $HASH2 is good,
297 # so we should not be able to tell the first bad commit
298 # among $HASH3 and $HASH4
299 test_expect_success 'bisect skip: with commit both bad and skipped' '
300 test_when_finished git bisect reset &&
301 git bisect start &&
302 git bisect skip &&
303 git bisect bad &&
304 git bisect good $HASH1 &&
305 git bisect skip &&
306 test_expect_code 2 git bisect good >my_bisect_log.txt &&
307 grep "first bad commit could be any of" my_bisect_log.txt &&
308 ! grep $HASH1 my_bisect_log.txt &&
309 ! grep $HASH2 my_bisect_log.txt &&
310 grep $HASH3 my_bisect_log.txt &&
311 grep $HASH4 my_bisect_log.txt
314 test_bisect_run_args () {
315 test_when_finished "rm -f run.sh actual" &&
316 >actual &&
317 cat >expect.args &&
318 cat <&6 >expect.out &&
319 cat <&7 >expect.err &&
320 write_script run.sh <<-\EOF &&
321 while test $# != 0
323 echo "<$1>" &&
324 shift
325 done >actual.args
328 test_when_finished "git bisect reset" &&
329 git bisect start &&
330 git bisect good $HASH1 &&
331 git bisect bad $HASH4 &&
332 git bisect run ./run.sh $@ >actual.out.raw 2>actual.err &&
333 # Prune just the log output
334 sed -n \
335 -e '/^Author:/d' \
336 -e '/^Date:/d' \
337 -e '/^$/d' \
338 -e '/^commit /d' \
339 -e '/^ /d' \
340 -e 'p' \
341 <actual.out.raw >actual.out &&
342 test_cmp expect.out actual.out &&
343 test_cmp expect.err actual.err &&
344 test_cmp expect.args actual.args
347 test_expect_success 'git bisect run: args, stdout and stderr with no arguments' "
348 test_bisect_run_args <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
349 EOF_ARGS
350 running './run.sh'
351 $HASH4 is the first bad commit
352 bisect found first bad commit
353 EOF_OUT
354 EOF_ERR
357 test_expect_success 'git bisect run: args, stdout and stderr: "--" argument' "
358 test_bisect_run_args -- <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
359 <-->
360 EOF_ARGS
361 running './run.sh' '--'
362 $HASH4 is the first bad commit
363 bisect found first bad commit
364 EOF_OUT
365 EOF_ERR
368 test_expect_success 'git bisect run: args, stdout and stderr: "--log foo --no-log bar" arguments' "
369 test_bisect_run_args --log foo --no-log bar <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
370 <--log>
371 <foo>
372 <--no-log>
373 <bar>
374 EOF_ARGS
375 running './run.sh' '--log' 'foo' '--no-log' 'bar'
376 $HASH4 is the first bad commit
377 bisect found first bad commit
378 EOF_OUT
379 EOF_ERR
382 test_expect_success 'git bisect run: args, stdout and stderr: "--bisect-start" argument' "
383 test_bisect_run_args --bisect-start <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
384 <--bisect-start>
385 EOF_ARGS
386 running './run.sh' '--bisect-start'
387 $HASH4 is the first bad commit
388 bisect found first bad commit
389 EOF_OUT
390 EOF_ERR
393 test_expect_success 'git bisect run: negative exit code' "
394 write_script fail.sh <<-'EOF' &&
395 exit 255
397 cat <<-'EOF' >expect &&
398 bisect run failed: exit code -1 from './fail.sh' is < 0 or >= 128
400 test_when_finished 'git bisect reset' &&
401 git bisect start &&
402 git bisect good $HASH1 &&
403 git bisect bad $HASH4 &&
404 ! git bisect run ./fail.sh 2>err &&
405 sed -En 's/.*(bisect.*code) (-?[0-9]+) (from.*)/\1 -1 \3/p' err >actual &&
406 test_cmp expect actual
409 test_expect_success 'git bisect run: unable to verify on good' "
410 write_script fail.sh <<-'EOF' &&
411 head=\$(git rev-parse --verify HEAD)
412 good=\$(git rev-parse --verify $HASH1)
413 if test "\$head" = "\$good"
414 then
415 exit 255
416 else
417 exit 127
420 cat <<-'EOF' >expect &&
421 unable to verify './fail.sh' on good revision
423 test_when_finished 'git bisect reset' &&
424 git bisect start &&
425 git bisect good $HASH1 &&
426 git bisect bad $HASH4 &&
427 ! git bisect run ./fail.sh 2>err &&
428 sed -n 's/.*\(unable to verify.*\)/\1/p' err >actual &&
429 test_cmp expect actual
432 # We want to automatically find the commit that
433 # added "Another" into hello.
434 test_expect_success '"git bisect run" simple case' '
435 write_script test_script.sh <<-\EOF &&
436 ! grep Another hello >/dev/null
438 git bisect start &&
439 git bisect good $HASH1 &&
440 git bisect bad $HASH4 &&
441 git bisect run ./test_script.sh >my_bisect_log.txt &&
442 grep "$HASH3 is the first bad commit" my_bisect_log.txt &&
443 git bisect reset
446 # We want to make sure no arguments has been eaten
447 test_expect_success '"git bisect run" simple case' '
448 git bisect start &&
449 git bisect good $HASH1 &&
450 git bisect bad $HASH4 &&
451 git bisect run printf "%s %s\n" reset --bisect-skip >my_bisect_log.txt &&
452 grep -e "reset --bisect-skip" my_bisect_log.txt &&
453 git bisect reset
456 # We want to automatically find the commit that
457 # added "Ciao" into hello.
458 test_expect_success '"git bisect run" with more complex "git bisect start"' '
459 write_script test_script.sh <<-\EOF &&
460 ! grep Ciao hello >/dev/null
462 git bisect start $HASH4 $HASH1 &&
463 git bisect run ./test_script.sh >my_bisect_log.txt &&
464 grep "$HASH4 is the first bad commit" my_bisect_log.txt &&
465 git bisect reset
468 test_expect_success 'bisect run accepts exit code 126 as bad' '
469 test_when_finished "git bisect reset" &&
470 write_script test_script.sh <<-\EOF &&
471 ! grep Another hello || exit 126 >/dev/null
473 git bisect start &&
474 git bisect good $HASH1 &&
475 git bisect bad $HASH4 &&
476 git bisect run ./test_script.sh >my_bisect_log.txt &&
477 grep "$HASH3 is the first bad commit" my_bisect_log.txt
480 test_expect_success POSIXPERM 'bisect run fails with non-executable test script' '
481 test_when_finished "git bisect reset" &&
482 >not-executable.sh &&
483 chmod -x not-executable.sh &&
484 git bisect start &&
485 git bisect good $HASH1 &&
486 git bisect bad $HASH4 &&
487 test_must_fail git bisect run ./not-executable.sh >my_bisect_log.txt &&
488 ! grep "is the first bad commit" my_bisect_log.txt
491 test_expect_success 'bisect run accepts exit code 127 as bad' '
492 test_when_finished "git bisect reset" &&
493 write_script test_script.sh <<-\EOF &&
494 ! grep Another hello || exit 127 >/dev/null
496 git bisect start &&
497 git bisect good $HASH1 &&
498 git bisect bad $HASH4 &&
499 git bisect run ./test_script.sh >my_bisect_log.txt &&
500 grep "$HASH3 is the first bad commit" my_bisect_log.txt
503 test_expect_success 'bisect run fails with missing test script' '
504 test_when_finished "git bisect reset" &&
505 rm -f does-not-exist.sh &&
506 git bisect start &&
507 git bisect good $HASH1 &&
508 git bisect bad $HASH4 &&
509 test_must_fail git bisect run ./does-not-exist.sh >my_bisect_log.txt &&
510 ! grep "is the first bad commit" my_bisect_log.txt
513 # $HASH1 is good, $HASH5 is bad, we skip $HASH3
514 # but $HASH4 is good,
515 # so we should find $HASH5 as the first bad commit
516 HASH5=
517 test_expect_success 'bisect skip: add line and then a new test' '
518 add_line_into_file "5: Another new line." hello &&
519 HASH5=$(git rev-parse --verify HEAD) &&
520 git bisect start $HASH5 $HASH1 &&
521 git bisect skip &&
522 git bisect good > my_bisect_log.txt &&
523 grep "$HASH5 is the first bad commit" my_bisect_log.txt &&
524 git bisect log > log_to_replay.txt &&
525 git bisect reset
528 test_expect_success 'bisect skip and bisect replay' '
529 git bisect replay log_to_replay.txt > my_bisect_log.txt &&
530 grep "$HASH5 is the first bad commit" my_bisect_log.txt &&
531 git bisect reset
534 HASH6=
535 test_expect_success 'bisect run & skip: cannot tell between 2' '
536 add_line_into_file "6: Yet a line." hello &&
537 HASH6=$(git rev-parse --verify HEAD) &&
538 write_script test_script.sh <<-\EOF &&
539 sed -ne \$p hello | grep Ciao >/dev/null && exit 125
540 ! grep line hello >/dev/null
542 git bisect start $HASH6 $HASH1 &&
543 test_expect_code 2 git bisect run ./test_script.sh >my_bisect_log.txt &&
544 grep "first bad commit could be any of" my_bisect_log.txt &&
545 ! grep $HASH3 my_bisect_log.txt &&
546 ! grep $HASH6 my_bisect_log.txt &&
547 grep $HASH4 my_bisect_log.txt &&
548 grep $HASH5 my_bisect_log.txt
551 HASH7=
552 test_expect_success 'bisect run & skip: find first bad' '
553 git bisect reset &&
554 add_line_into_file "7: Should be the last line." hello &&
555 HASH7=$(git rev-parse --verify HEAD) &&
556 write_script test_script.sh <<-\EOF &&
557 sed -ne \$p hello | grep Ciao >/dev/null && exit 125
558 sed -ne \$p hello | grep day >/dev/null && exit 125
559 ! grep Yet hello >/dev/null
561 git bisect start $HASH7 $HASH1 &&
562 git bisect run ./test_script.sh >my_bisect_log.txt &&
563 grep "$HASH6 is the first bad commit" my_bisect_log.txt
566 test_expect_success 'bisect skip only one range' '
567 git bisect reset &&
568 git bisect start $HASH7 $HASH1 &&
569 git bisect skip $HASH1..$HASH5 &&
570 test "$HASH6" = "$(git rev-parse --verify HEAD)" &&
571 test_must_fail git bisect bad > my_bisect_log.txt &&
572 grep "first bad commit could be any of" my_bisect_log.txt
575 test_expect_success 'bisect skip many ranges' '
576 git bisect start $HASH7 $HASH1 &&
577 test "$HASH4" = "$(git rev-parse --verify HEAD)" &&
578 git bisect skip $HASH2 $HASH2.. ..$HASH5 &&
579 test "$HASH6" = "$(git rev-parse --verify HEAD)" &&
580 test_must_fail git bisect bad > my_bisect_log.txt &&
581 grep "first bad commit could be any of" my_bisect_log.txt
584 test_expect_success 'bisect starting with a detached HEAD' '
585 git bisect reset &&
586 git checkout main^ &&
587 HEAD=$(git rev-parse --verify HEAD) &&
588 git bisect start &&
589 test $HEAD = $(cat .git/BISECT_START) &&
590 git bisect reset &&
591 test $HEAD = $(git rev-parse --verify HEAD)
594 test_expect_success 'bisect errors out if bad and good are mistaken' '
595 git bisect reset &&
596 test_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&
597 test_grep "mistook good and bad" rev_list_error &&
598 git bisect reset
601 test_expect_success 'bisect does not create a "bisect" branch' '
602 git bisect reset &&
603 git bisect start $HASH7 $HASH1 &&
604 git branch bisect &&
605 rev_hash4=$(git rev-parse --verify HEAD) &&
606 test "$rev_hash4" = "$HASH4" &&
607 git branch -D bisect &&
608 git bisect good &&
609 git branch bisect &&
610 rev_hash6=$(git rev-parse --verify HEAD) &&
611 test "$rev_hash6" = "$HASH6" &&
612 git bisect good > my_bisect_log.txt &&
613 grep "$HASH7 is the first bad commit" my_bisect_log.txt &&
614 git bisect reset &&
615 rev_hash6=$(git rev-parse --verify bisect) &&
616 test "$rev_hash6" = "$HASH6" &&
617 git branch -D bisect
620 # This creates a "side" branch to test "siblings" cases.
622 # H1-H2-H3-H4-H5-H6-H7 <--other
624 # S5-S6-S7 <--side
626 test_expect_success 'side branch creation' '
627 git bisect reset &&
628 git checkout -b side $HASH4 &&
629 add_line_into_file "5(side): first line on a side branch" hello2 &&
630 SIDE_HASH5=$(git rev-parse --verify HEAD) &&
631 add_line_into_file "6(side): second line on a side branch" hello2 &&
632 SIDE_HASH6=$(git rev-parse --verify HEAD) &&
633 add_line_into_file "7(side): third line on a side branch" hello2 &&
634 SIDE_HASH7=$(git rev-parse --verify HEAD)
637 test_expect_success 'good merge base when good and bad are siblings' '
638 git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
639 test_grep "merge base must be tested" my_bisect_log.txt &&
640 grep $HASH4 my_bisect_log.txt &&
641 git bisect good > my_bisect_log.txt &&
642 ! grep "merge base must be tested" my_bisect_log.txt &&
643 grep $HASH6 my_bisect_log.txt &&
644 git bisect reset
646 test_expect_success 'skipped merge base when good and bad are siblings' '
647 git bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt &&
648 test_grep "merge base must be tested" my_bisect_log.txt &&
649 grep $HASH4 my_bisect_log.txt &&
650 git bisect skip > my_bisect_log.txt 2>&1 &&
651 grep "warning" my_bisect_log.txt &&
652 grep $SIDE_HASH6 my_bisect_log.txt &&
653 git bisect reset
656 test_expect_success 'bad merge base when good and bad are siblings' '
657 git bisect start "$HASH7" HEAD > my_bisect_log.txt &&
658 test_grep "merge base must be tested" my_bisect_log.txt &&
659 grep $HASH4 my_bisect_log.txt &&
660 test_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&
661 test_grep "merge base $HASH4 is bad" my_bisect_log.txt &&
662 test_grep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
663 git bisect reset
666 # This creates a few more commits (A and B) to test "siblings" cases
667 # when a good and a bad rev have many merge bases.
669 # We should have the following:
671 # H1-H2-H3-H4-H5-H6-H7
672 # \ \ \
673 # S5-A \
674 # \ \
675 # S6-S7----B
677 # And there A and B have 2 merge bases (S5 and H5) that should be
678 # reported by "git merge-base --all A B".
680 test_expect_success 'many merge bases creation' '
681 git checkout "$SIDE_HASH5" &&
682 git merge -m "merge HASH5 and SIDE_HASH5" "$HASH5" &&
683 A_HASH=$(git rev-parse --verify HEAD) &&
684 git checkout side &&
685 git merge -m "merge HASH7 and SIDE_HASH7" "$HASH7" &&
686 B_HASH=$(git rev-parse --verify HEAD) &&
687 git merge-base --all "$A_HASH" "$B_HASH" > merge_bases.txt &&
688 test_line_count = 2 merge_bases.txt &&
689 grep "$HASH5" merge_bases.txt &&
690 grep "$SIDE_HASH5" merge_bases.txt
693 # We want to automatically find the merge that
694 # added "line" into hello.
695 test_expect_success '"git bisect run --first-parent" simple case' '
696 git rev-list --first-parent $B_HASH ^$HASH4 >first_parent_chain.txt &&
697 write_script test_script.sh <<-\EOF &&
698 grep $(git rev-parse HEAD) first_parent_chain.txt || exit -1
699 ! grep line hello >/dev/null
701 git bisect start --first-parent &&
702 test_path_is_file ".git/BISECT_FIRST_PARENT" &&
703 git bisect good $HASH4 &&
704 git bisect bad $B_HASH &&
705 git bisect run ./test_script.sh >my_bisect_log.txt &&
706 grep "$B_HASH is the first bad commit" my_bisect_log.txt &&
707 git bisect reset &&
708 test_path_is_missing .git/BISECT_FIRST_PARENT
711 test_expect_success 'good merge bases when good and bad are siblings' '
712 git bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt &&
713 test_grep "merge base must be tested" my_bisect_log.txt &&
714 git bisect good > my_bisect_log2.txt &&
715 test_grep "merge base must be tested" my_bisect_log2.txt &&
718 grep "$SIDE_HASH5" my_bisect_log.txt &&
719 grep "$HASH5" my_bisect_log2.txt
720 } || {
721 grep "$SIDE_HASH5" my_bisect_log2.txt &&
722 grep "$HASH5" my_bisect_log.txt
724 } &&
725 git bisect reset
728 test_expect_success 'optimized merge base checks' '
729 git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
730 test_grep "merge base must be tested" my_bisect_log.txt &&
731 grep "$HASH4" my_bisect_log.txt &&
732 git bisect good > my_bisect_log2.txt &&
733 test -f ".git/BISECT_ANCESTORS_OK" &&
734 test "$HASH6" = $(git rev-parse --verify HEAD) &&
735 git bisect bad &&
736 git bisect good "$A_HASH" > my_bisect_log4.txt &&
737 test_grep "merge base must be tested" my_bisect_log4.txt &&
738 test_path_is_missing ".git/BISECT_ANCESTORS_OK"
741 # This creates another side branch called "parallel" with some files
742 # in some directories, to test bisecting with paths.
744 # We should have the following:
746 # P1-P2-P3-P4-P5-P6-P7
747 # / / /
748 # H1-H2-H3-H4-H5-H6-H7
749 # \ \ \
750 # S5-A \
751 # \ \
752 # S6-S7----B
754 test_expect_success '"parallel" side branch creation' '
755 git bisect reset &&
756 git checkout -b parallel $HASH1 &&
757 mkdir dir1 dir2 &&
758 add_line_into_file "1(para): line 1 on parallel branch" dir1/file1 &&
759 PARA_HASH1=$(git rev-parse --verify HEAD) &&
760 add_line_into_file "2(para): line 2 on parallel branch" dir2/file2 &&
761 PARA_HASH2=$(git rev-parse --verify HEAD) &&
762 add_line_into_file "3(para): line 3 on parallel branch" dir2/file3 &&
763 PARA_HASH3=$(git rev-parse --verify HEAD) &&
764 git merge -m "merge HASH4 and PARA_HASH3" "$HASH4" &&
765 PARA_HASH4=$(git rev-parse --verify HEAD) &&
766 add_line_into_file "5(para): add line on parallel branch" dir1/file1 &&
767 PARA_HASH5=$(git rev-parse --verify HEAD) &&
768 add_line_into_file "6(para): add line on parallel branch" dir2/file2 &&
769 PARA_HASH6=$(git rev-parse --verify HEAD) &&
770 git merge -m "merge HASH7 and PARA_HASH6" "$HASH7" &&
771 PARA_HASH7=$(git rev-parse --verify HEAD)
774 test_expect_success 'restricting bisection on one dir' '
775 git bisect reset &&
776 git bisect start HEAD $HASH1 -- dir1 &&
777 para1=$(git rev-parse --verify HEAD) &&
778 test "$para1" = "$PARA_HASH1" &&
779 git bisect bad > my_bisect_log.txt &&
780 grep "$PARA_HASH1 is the first bad commit" my_bisect_log.txt
783 test_expect_success 'restricting bisection on one dir and a file' '
784 git bisect reset &&
785 git bisect start HEAD $HASH1 -- dir1 hello &&
786 para4=$(git rev-parse --verify HEAD) &&
787 test "$para4" = "$PARA_HASH4" &&
788 git bisect bad &&
789 hash3=$(git rev-parse --verify HEAD) &&
790 test "$hash3" = "$HASH3" &&
791 git bisect good &&
792 hash4=$(git rev-parse --verify HEAD) &&
793 test "$hash4" = "$HASH4" &&
794 git bisect good &&
795 para1=$(git rev-parse --verify HEAD) &&
796 test "$para1" = "$PARA_HASH1" &&
797 git bisect good > my_bisect_log.txt &&
798 grep "$PARA_HASH4 is the first bad commit" my_bisect_log.txt
801 test_expect_success 'skipping away from skipped commit' '
802 git bisect start $PARA_HASH7 $HASH1 &&
803 para4=$(git rev-parse --verify HEAD) &&
804 test "$para4" = "$PARA_HASH4" &&
805 git bisect skip &&
806 hash7=$(git rev-parse --verify HEAD) &&
807 test "$hash7" = "$HASH7" &&
808 git bisect skip &&
809 para3=$(git rev-parse --verify HEAD) &&
810 test "$para3" = "$PARA_HASH3"
813 test_expect_success 'erroring out when using bad path arguments' '
814 test_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&
815 test_grep "bad path arguments" error.txt
818 test_expect_success 'test bisection on bare repo - --no-checkout specified' '
819 git clone --bare . bare.nocheckout &&
821 cd bare.nocheckout &&
822 git bisect start --no-checkout &&
823 git bisect good $HASH1 &&
824 git bisect bad $HASH4 &&
825 git bisect run eval \
826 "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
827 >../nocheckout.log
828 ) &&
829 grep "$HASH3 is the first bad commit" nocheckout.log
833 test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '
834 git clone --bare . bare.defaulted &&
836 cd bare.defaulted &&
837 git bisect start &&
838 git bisect good $HASH1 &&
839 git bisect bad $HASH4 &&
840 git bisect run eval \
841 "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
842 >../defaulted.log
843 ) &&
844 grep "$HASH3 is the first bad commit" defaulted.log
848 # This creates a broken branch which cannot be checked out because
849 # the tree created has been deleted.
851 # H1-H2-H3-H4-H5-H6-H7 <--other
853 # S5-S6'-S7'-S8'-S9 <--broken
855 # Commits marked with ' have a missing tree.
857 test_expect_success 'broken branch creation' '
858 git bisect reset &&
859 git checkout -b broken $HASH4 &&
860 git tag BROKEN_HASH4 $HASH4 &&
861 add_line_into_file "5(broken): first line on a broken branch" hello2 &&
862 git tag BROKEN_HASH5 &&
863 mkdir missing &&
864 :> missing/MISSING &&
865 git add missing/MISSING &&
866 git commit -m "6(broken): Added file that will be deleted" &&
867 git tag BROKEN_HASH6 &&
868 deleted=$(git rev-parse --verify HEAD:missing) &&
869 add_line_into_file "7(broken): second line on a broken branch" hello2 &&
870 git tag BROKEN_HASH7 &&
871 add_line_into_file "8(broken): third line on a broken branch" hello2 &&
872 git tag BROKEN_HASH8 &&
873 git rm missing/MISSING &&
874 git commit -m "9(broken): Remove missing file" &&
875 git tag BROKEN_HASH9 &&
876 rm .git/objects/$(test_oid_to_path $deleted)
879 echo "" > expected.ok
880 cat > expected.missing-tree.default <<EOF
881 fatal: unable to read tree ($deleted)
884 test_expect_success 'bisect fails if tree is broken on start commit' '
885 git bisect reset &&
886 test_must_fail git bisect start BROKEN_HASH7 BROKEN_HASH4 2>error.txt &&
887 test_cmp expected.missing-tree.default error.txt
890 test_expect_success 'bisect fails if tree is broken on trial commit' '
891 git bisect reset &&
892 test_must_fail git bisect start BROKEN_HASH9 BROKEN_HASH4 2>error.txt &&
893 git reset --hard broken &&
894 git checkout broken &&
895 test_cmp expected.missing-tree.default error.txt
898 check_same()
900 echo "Checking $1 is the same as $2" &&
901 test_cmp_rev "$1" "$2"
904 test_expect_success 'bisect: --no-checkout - start commit bad' '
905 git bisect reset &&
906 git bisect start BROKEN_HASH7 BROKEN_HASH4 --no-checkout &&
907 check_same BROKEN_HASH6 BISECT_HEAD &&
908 git bisect reset
911 test_expect_success 'bisect: --no-checkout - trial commit bad' '
912 git bisect reset &&
913 git bisect start broken BROKEN_HASH4 --no-checkout &&
914 check_same BROKEN_HASH6 BISECT_HEAD &&
915 git bisect reset
918 test_expect_success 'bisect: --no-checkout - target before breakage' '
919 git bisect reset &&
920 git bisect start broken BROKEN_HASH4 --no-checkout &&
921 check_same BROKEN_HASH6 BISECT_HEAD &&
922 git bisect bad BISECT_HEAD &&
923 check_same BROKEN_HASH5 BISECT_HEAD &&
924 git bisect bad BISECT_HEAD &&
925 check_same BROKEN_HASH5 bisect/bad &&
926 git bisect reset
929 test_expect_success 'bisect: --no-checkout - target in breakage' '
930 git bisect reset &&
931 git bisect start broken BROKEN_HASH4 --no-checkout &&
932 check_same BROKEN_HASH6 BISECT_HEAD &&
933 git bisect bad BISECT_HEAD &&
934 check_same BROKEN_HASH5 BISECT_HEAD &&
935 test_must_fail git bisect good BISECT_HEAD &&
936 check_same BROKEN_HASH6 bisect/bad &&
937 git bisect reset
940 test_expect_success 'bisect: --no-checkout - target after breakage' '
941 git bisect reset &&
942 git bisect start broken BROKEN_HASH4 --no-checkout &&
943 check_same BROKEN_HASH6 BISECT_HEAD &&
944 git bisect good BISECT_HEAD &&
945 check_same BROKEN_HASH8 BISECT_HEAD &&
946 test_must_fail git bisect good BISECT_HEAD &&
947 check_same BROKEN_HASH9 bisect/bad &&
948 git bisect reset
951 test_expect_success 'bisect: demonstrate identification of damage boundary' "
952 git bisect reset &&
953 git checkout broken &&
954 git bisect start broken main --no-checkout &&
955 test_must_fail git bisect run \"\$SHELL_PATH\" -c '
956 GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
957 git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
958 git pack-objects --stdout >/dev/null < tmp.\$\$
959 rc=\$?
960 rm -f tmp.\$\$
961 test \$rc = 0' &&
962 check_same BROKEN_HASH6 bisect/bad &&
963 git bisect reset
966 cat > expected.bisect-log <<EOF
967 # bad: [$HASH4] Add <4: Ciao for now> into <hello>.
968 # good: [$HASH2] Add <2: A new day for git> into <hello>.
969 git bisect start '$HASH4' '$HASH2'
970 # good: [$HASH3] Add <3: Another new day for git> into <hello>.
971 git bisect good $HASH3
972 # first bad commit: [$HASH4] Add <4: Ciao for now> into <hello>.
975 test_expect_success 'bisect log: successful result' '
976 git bisect reset &&
977 git bisect start $HASH4 $HASH2 &&
978 git bisect good &&
979 git bisect log >bisect-log.txt &&
980 test_cmp expected.bisect-log bisect-log.txt &&
981 git bisect reset
984 cat > expected.bisect-skip-log <<EOF
985 # bad: [$HASH4] Add <4: Ciao for now> into <hello>.
986 # good: [$HASH2] Add <2: A new day for git> into <hello>.
987 git bisect start '$HASH4' '$HASH2'
988 # skip: [$HASH3] Add <3: Another new day for git> into <hello>.
989 git bisect skip $HASH3
990 # only skipped commits left to test
991 # possible first bad commit: [$HASH4] Add <4: Ciao for now> into <hello>.
992 # possible first bad commit: [$HASH3] Add <3: Another new day for git> into <hello>.
995 test_expect_success 'bisect log: only skip commits left' '
996 git bisect reset &&
997 git bisect start $HASH4 $HASH2 &&
998 test_must_fail git bisect skip &&
999 git bisect log >bisect-skip-log.txt &&
1000 test_cmp expected.bisect-skip-log bisect-skip-log.txt &&
1001 git bisect reset
1004 test_expect_success '"git bisect bad HEAD" behaves as "git bisect bad"' '
1005 git checkout parallel &&
1006 git bisect start HEAD $HASH1 &&
1007 git bisect good HEAD &&
1008 git bisect bad HEAD &&
1009 test "$HASH6" = $(git rev-parse --verify HEAD) &&
1010 git bisect reset
1013 test_expect_success 'bisect starts with only one new' '
1014 git bisect reset &&
1015 git bisect start &&
1016 git bisect new $HASH4 &&
1017 git bisect next
1020 test_expect_success 'bisect does not start with only one old' '
1021 git bisect reset &&
1022 git bisect start &&
1023 git bisect old $HASH1 &&
1024 test_must_fail git bisect next
1027 test_expect_success 'bisect start with one new and old' '
1028 git bisect reset &&
1029 git bisect start &&
1030 git bisect old $HASH1 &&
1031 git bisect new $HASH4 &&
1032 git bisect new &&
1033 git bisect new >bisect_result &&
1034 grep "$HASH2 is the first new commit" bisect_result &&
1035 git bisect log >log_to_replay.txt &&
1036 git bisect reset
1039 test_expect_success 'bisect replay with old and new' '
1040 git bisect replay log_to_replay.txt >bisect_result &&
1041 grep "$HASH2 is the first new commit" bisect_result &&
1042 git bisect reset
1045 test_expect_success 'bisect replay with CRLF log' '
1046 append_cr <log_to_replay.txt >log_to_replay_crlf.txt &&
1047 git bisect replay log_to_replay_crlf.txt >bisect_result_crlf &&
1048 grep "$HASH2 is the first new commit" bisect_result_crlf &&
1049 git bisect reset
1052 test_expect_success 'bisect cannot mix old/new and good/bad' '
1053 git bisect start &&
1054 git bisect bad $HASH4 &&
1055 test_must_fail git bisect old $HASH1
1058 test_expect_success 'bisect terms needs 0 or 1 argument' '
1059 git bisect reset &&
1060 test_must_fail git bisect terms only-one &&
1061 test_must_fail git bisect terms 1 2 &&
1062 test_must_fail git bisect terms 2>actual &&
1063 echo "error: no terms defined" >expected &&
1064 test_cmp expected actual
1067 test_expect_success 'bisect terms shows good/bad after start' '
1068 git bisect reset &&
1069 git bisect start HEAD $HASH1 &&
1070 git bisect terms --term-good >actual &&
1071 echo good >expected &&
1072 test_cmp expected actual &&
1073 git bisect terms --term-bad >actual &&
1074 echo bad >expected &&
1075 test_cmp expected actual
1078 test_expect_success 'bisect start with one term1 and term2' '
1079 git bisect reset &&
1080 git bisect start --term-old term2 --term-new term1 &&
1081 git bisect term2 $HASH1 &&
1082 git bisect term1 $HASH4 &&
1083 git bisect term1 &&
1084 git bisect term1 >bisect_result &&
1085 grep "$HASH2 is the first term1 commit" bisect_result &&
1086 git bisect log >log_to_replay.txt &&
1087 git bisect reset
1090 test_expect_success 'bogus command does not start bisect' '
1091 git bisect reset &&
1092 test_must_fail git bisect --bisect-terms 1 2 2>out &&
1093 ! grep "You need to start" out &&
1094 test_must_fail git bisect --bisect-terms 2>out &&
1095 ! grep "You need to start" out &&
1096 grep "git bisect.*visualize" out &&
1097 git bisect reset
1100 test_expect_success 'bisect replay with term1 and term2' '
1101 git bisect replay log_to_replay.txt >bisect_result &&
1102 grep "$HASH2 is the first term1 commit" bisect_result &&
1103 git bisect reset
1106 test_expect_success 'bisect start term1 term2' '
1107 git bisect reset &&
1108 git bisect start --term-new term1 --term-old term2 $HASH4 $HASH1 &&
1109 git bisect term1 &&
1110 git bisect term1 >bisect_result &&
1111 grep "$HASH2 is the first term1 commit" bisect_result &&
1112 git bisect log >log_to_replay.txt &&
1113 git bisect reset
1116 test_expect_success 'bisect cannot mix terms' '
1117 git bisect reset &&
1118 git bisect start --term-good term1 --term-bad term2 $HASH4 $HASH1 &&
1119 test_must_fail git bisect a &&
1120 test_must_fail git bisect b &&
1121 test_must_fail git bisect bad &&
1122 test_must_fail git bisect good &&
1123 test_must_fail git bisect new &&
1124 test_must_fail git bisect old
1127 test_expect_success 'bisect terms rejects invalid terms' '
1128 git bisect reset &&
1129 test_must_fail git bisect start --term-good &&
1130 test_must_fail git bisect start --term-good invalid..term &&
1131 test_must_fail git bisect start --term-bad &&
1132 test_must_fail git bisect terms --term-bad invalid..term &&
1133 test_must_fail git bisect terms --term-good bad &&
1134 test_must_fail git bisect terms --term-good old &&
1135 test_must_fail git bisect terms --term-good skip &&
1136 test_must_fail git bisect terms --term-good reset &&
1137 test_path_is_missing .git/BISECT_TERMS
1140 test_expect_success 'bisect start --term-* does store terms' '
1141 git bisect reset &&
1142 git bisect start --term-bad=one --term-good=two &&
1143 git bisect terms >actual &&
1144 cat <<-EOF >expected &&
1145 Your current terms are two for the old state
1146 and one for the new state.
1148 test_cmp expected actual &&
1149 git bisect terms --term-bad >actual &&
1150 echo one >expected &&
1151 test_cmp expected actual &&
1152 git bisect terms --term-good >actual &&
1153 echo two >expected &&
1154 test_cmp expected actual
1157 test_expect_success 'bisect start takes options and revs in any order' '
1158 git bisect reset &&
1159 git bisect start --term-good one $HASH4 \
1160 --term-good two --term-bad bad-term \
1161 $HASH1 --term-good three -- &&
1162 (git bisect terms --term-bad && git bisect terms --term-good) >actual &&
1163 printf "%s\n%s\n" bad-term three >expected &&
1164 test_cmp expected actual
1167 # Bisect is started with --term-new and --term-old arguments,
1168 # then skip. The HEAD should be changed.
1169 test_expect_success 'bisect skip works with --term*' '
1170 git bisect reset &&
1171 git bisect start --term-new=fixed --term-old=unfixed HEAD $HASH1 &&
1172 hash_skipped_from=$(git rev-parse --verify HEAD) &&
1173 git bisect skip &&
1174 hash_skipped_to=$(git rev-parse --verify HEAD) &&
1175 test "$hash_skipped_from" != "$hash_skipped_to"
1178 test_expect_success 'git bisect reset cleans bisection state properly' '
1179 git bisect reset &&
1180 git bisect start &&
1181 git bisect good $HASH1 &&
1182 git bisect bad $HASH4 &&
1183 git bisect reset &&
1184 test -z "$(git for-each-ref "refs/bisect/*")" &&
1185 test_ref_missing BISECT_EXPECTED_REV &&
1186 test_path_is_missing ".git/BISECT_ANCESTORS_OK" &&
1187 test_path_is_missing ".git/BISECT_LOG" &&
1188 test_path_is_missing ".git/BISECT_RUN" &&
1189 test_path_is_missing ".git/BISECT_TERMS" &&
1190 test_path_is_missing ".git/BISECT_HEAD" &&
1191 test_path_is_missing ".git/BISECT_START"
1194 test_expect_success 'bisect handles annotated tags' '
1195 test_commit commit-one &&
1196 git tag -m foo tag-one &&
1197 test_commit commit-two &&
1198 git tag -m foo tag-two &&
1199 git bisect start &&
1200 git bisect good tag-one &&
1201 git bisect bad tag-two >output &&
1202 bad=$(git rev-parse --verify tag-two^{commit}) &&
1203 grep "$bad is the first bad commit" output
1206 test_expect_success 'bisect run fails with exit code equals or greater than 128' '
1207 write_script test_script.sh <<-\EOF &&
1208 exit 128
1210 test_must_fail git bisect run ./test_script.sh &&
1211 write_script test_script.sh <<-\EOF &&
1212 exit 255
1214 test_must_fail git bisect run ./test_script.sh
1217 test_expect_success 'bisect visualize with a filename with dash and space' '
1218 echo "My test line" >>"./-hello 2" &&
1219 git add -- "./-hello 2" &&
1220 git commit --quiet -m "Add test line" -- "./-hello 2" &&
1221 git bisect visualize -p -- "-hello 2"
1224 test_expect_success 'bisect state output with multiple good commits' '
1225 git bisect reset &&
1226 git bisect start >output &&
1227 grep "waiting for both good and bad commits" output &&
1228 git bisect log >output &&
1229 grep "waiting for both good and bad commits" output &&
1230 git bisect good "$HASH1" >output &&
1231 grep "waiting for bad commit, 1 good commit known" output &&
1232 git bisect log >output &&
1233 grep "waiting for bad commit, 1 good commit known" output &&
1234 git bisect good "$HASH2" >output &&
1235 grep "waiting for bad commit, 2 good commits known" output &&
1236 git bisect log >output &&
1237 grep "waiting for bad commit, 2 good commits known" output
1240 test_expect_success 'bisect state output with bad commit' '
1241 git bisect reset &&
1242 git bisect start >output &&
1243 grep "waiting for both good and bad commits" output &&
1244 git bisect log >output &&
1245 grep "waiting for both good and bad commits" output &&
1246 git bisect bad "$HASH4" >output &&
1247 grep -F "waiting for good commit(s), bad commit known" output &&
1248 git bisect log >output &&
1249 grep -F "waiting for good commit(s), bad commit known" output
1252 test_expect_success 'verify correct error message' '
1253 git bisect reset &&
1254 git bisect start $HASH4 $HASH1 &&
1255 write_script test_script.sh <<-\EOF &&
1256 rm .git/BISECT*
1258 test_must_fail git bisect run ./test_script.sh 2>error &&
1259 grep "git bisect good.*exited with error code" error
1262 test_done