(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'Tests git bisect functionality'>)} spids: [12] ) ] ) (command.Simple words: [{<exec>}] redirects: [(redir op:<Id.Redir_Less '<'> loc:(redir_loc.Fd fd:0) arg:{<'/dev/null'>})] do_fork: T ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: add_line_into_file body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_line) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [36] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_file) op: assign_op.Equal rhs: {($ Id.VSub_Number '$2')} spids: [40] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ ($ Id.VSub_DollarName '$_file'))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$_line'))}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$_file')} ) ] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {($ Id.VSub_QMark '$?')} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:MSG) op: assign_op.Equal rhs: { (DQ <'Add <'> ($ Id.VSub_DollarName '$_line') <'> into <'> ($ Id.VSub_DollarName '$_file') <'>.'> ) } spids: [78] ) ] ) ] spids: [45 58] ) ] else_action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$_line'))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$_file')} ) ] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {($ Id.VSub_QMark '$?')} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<git>} {<add>} {($ Id.VSub_DollarName '$_file')}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {($ Id.VSub_QMark '$?')} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:MSG) op: assign_op.Equal rhs: { (DQ <'Create file <'> ($ Id.VSub_DollarName '$_file') <'> with <'> ($ Id.VSub_DollarName '$_line') <'> inside.'> ) } spids: [121] ) ] ) ] ) (C {<test_tick>}) (C {<git>} {<commit>} {<--quiet>} {<-m>} {(DQ ($ Id.VSub_DollarName '$MSG'))} {($ Id.VSub_DollarName '$_file')} ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HASH1) op: assign_op.Equal rhs: (word.Empty) spids: [155] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HASH2) op: assign_op.Equal rhs: (word.Empty) spids: [157] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HASH3) op: assign_op.Equal rhs: (word.Empty) spids: [159] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HASH4) op: assign_op.Equal rhs: (word.Empty) spids: [161] ) ] ) (C {<test_expect_success>} {(SQ <'set up basic repo with 1 file (hello) and 4 commits'>)} { (SQ <'\n'> <' add_line_into_file "1: Hello World" hello &&\n'> <' HASH1=$(git rev-parse --verify HEAD) &&\n'> <' add_line_into_file "2: A new day for git" hello &&\n'> <' HASH2=$(git rev-parse --verify HEAD) &&\n'> <' add_line_into_file "3: Another new day for git" hello &&\n'> <' HASH3=$(git rev-parse --verify HEAD) &&\n'> <' add_line_into_file "4: Ciao for now" hello &&\n'> <' HASH4=$(git rev-parse --verify HEAD)\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect starts with only one bad'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect bad $HASH4 &&\n'> <'\tgit bisect next\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect does not start with only one good'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect good $HASH1 &&\n'> <'\ttest_must_fail git bisect next\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start with one bad and good'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect good $HASH1 &&\n'> <'\tgit bisect bad $HASH4 &&\n'> <'\tgit bisect next\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect fails if given any junk instead of revs'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\ttest_must_fail git bisect start foo $HASH1 -- &&\n'> <'\ttest_must_fail git bisect start $HASH4 $HASH1 bar -- &&\n'> <'\ttest -z "$(git for-each-ref "refs/bisect/*")" &&\n'> <'\ttest -z "$(ls .git/BISECT_* 2>/dev/null)" &&\n'> <'\tgit bisect start &&\n'> <'\ttest_must_fail git bisect good foo $HASH1 &&\n'> <'\ttest_must_fail git bisect good $HASH1 bar &&\n'> <'\ttest_must_fail git bisect bad frotz &&\n'> <'\ttest_must_fail git bisect bad $HASH3 $HASH4 &&\n'> <'\ttest_must_fail git bisect skip bar $HASH3 &&\n'> <'\ttest_must_fail git bisect skip $HASH1 foo &&\n'> <'\ttest -z "$(git for-each-ref "refs/bisect/*")" &&\n'> <'\tgit bisect good $HASH1 &&\n'> <'\tgit bisect bad $HASH4\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect reset: back in the master branch'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\techo "* master" > branch.expect &&\n'> <'\tgit branch > branch.output &&\n'> <'\tcmp branch.expect branch.output\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect reset: back in another branch'>)} { (SQ <'\n'> <'\tgit checkout -b other &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect good $HASH1 &&\n'> <'\tgit bisect bad $HASH3 &&\n'> <'\tgit bisect reset &&\n'> <'\techo " master" > branch.expect &&\n'> <'\techo "* other" >> branch.expect &&\n'> <'\tgit branch > branch.output &&\n'> <'\tcmp branch.expect branch.output\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect reset when not bisecting'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit branch > branch.output &&\n'> <'\tcmp branch.expect branch.output\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect reset removes packed refs'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect good $HASH1 &&\n'> <'\tgit bisect bad $HASH3 &&\n'> <'\tgit pack-refs --all --prune &&\n'> <'\tgit bisect next &&\n'> <'\tgit bisect reset &&\n'> <'\ttest -z "$(git for-each-ref "refs/bisect/*")" &&\n'> <'\ttest -z "$(git for-each-ref "refs/heads/bisect")"\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect reset removes bisect state after --no-checkout'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start --no-checkout &&\n'> <'\tgit bisect good $HASH1 &&\n'> <'\tgit bisect bad $HASH3 &&\n'> <'\tgit bisect next &&\n'> <'\tgit bisect reset &&\n'> <'\ttest -z "$(git for-each-ref "refs/bisect/*")" &&\n'> <'\ttest -z "$(git for-each-ref "refs/heads/bisect")" &&\n'> <'\ttest -z "$(git for-each-ref "BISECT_HEAD")"\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start: back in good branch'>)} { (SQ <'\n'> <'\tgit branch > branch.output &&\n'> <'\tgrep "* other" branch.output > /dev/null &&\n'> <'\tgit bisect start $HASH4 $HASH1 -- &&\n'> <'\tgit bisect good &&\n'> <'\tgit bisect start $HASH4 $HASH1 -- &&\n'> <'\tgit bisect bad &&\n'> <'\tgit bisect reset &&\n'> <'\tgit branch > branch.output &&\n'> <'\tgrep "* other" branch.output > /dev/null\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start: no ".git/BISECT_START" created if junk rev'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\ttest_must_fail git bisect start $HASH4 foo -- &&\n'> <'\tgit branch > branch.output &&\n'> <'\tgrep "* other" branch.output > /dev/null &&\n'> <'\ttest_must_fail test -e .git/BISECT_START\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start: existing ".git/BISECT_START" not modified if junk rev'>)} { (SQ <'\n'> <'\tgit bisect start $HASH4 $HASH1 -- &&\n'> <'\tgit bisect good &&\n'> <'\tcp .git/BISECT_START saved &&\n'> <'\ttest_must_fail git bisect start $HASH4 foo -- &&\n'> <'\tgit branch > branch.output &&\n'> < '\ttest_i18ngrep "* (no branch, bisect started on other)" branch.output > /dev/null &&\n' > <'\ttest_cmp saved .git/BISECT_START\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start: no ".git/BISECT_START" if mistaken rev'>)} { (SQ <'\n'> <'\tgit bisect start $HASH4 $HASH1 -- &&\n'> <'\tgit bisect good &&\n'> <'\ttest_must_fail git bisect start $HASH1 $HASH4 -- &&\n'> <'\tgit branch > branch.output &&\n'> <'\tgrep "* other" branch.output > /dev/null &&\n'> <'\ttest_must_fail test -e .git/BISECT_START\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start: no ".git/BISECT_START" if checkout error'>)} { (SQ <'\n'> <'\techo "temp stuff" > hello &&\n'> <'\ttest_must_fail git bisect start $HASH4 $HASH1 -- &&\n'> <'\tgit branch &&\n'> <'\tgit branch > branch.output &&\n'> <'\tgrep "* other" branch.output > /dev/null &&\n'> <'\ttest_must_fail test -e .git/BISECT_START &&\n'> <'\ttest -z "$(git for-each-ref "refs/bisect/*")" &&\n'> <'\tgit checkout HEAD hello\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect skip: successful result'>)} { (SQ <'\n'> <'\ttest_when_finished git bisect reset &&\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start $HASH4 $HASH1 &&\n'> <'\tgit bisect skip &&\n'> <'\tgit bisect bad > my_bisect_log.txt &&\n'> <'\tgrep "$HASH2 is the first bad commit" my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect skip: cannot tell between 3 commits'>)} { (SQ <'\n'> <'\ttest_when_finished git bisect reset &&\n'> <'\tgit bisect start $HASH4 $HASH1 &&\n'> <'\tgit bisect skip &&\n'> <'\ttest_expect_code 2 git bisect skip >my_bisect_log.txt &&\n'> <'\tgrep "first bad commit could be any of" my_bisect_log.txt &&\n'> <'\t! grep $HASH1 my_bisect_log.txt &&\n'> <'\tgrep $HASH2 my_bisect_log.txt &&\n'> <'\tgrep $HASH3 my_bisect_log.txt &&\n'> <'\tgrep $HASH4 my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect skip: cannot tell between 2 commits'>)} { (SQ <'\n'> <'\ttest_when_finished git bisect reset &&\n'> <'\tgit bisect start $HASH4 $HASH1 &&\n'> <'\tgit bisect skip &&\n'> <'\ttest_expect_code 2 git bisect good >my_bisect_log.txt &&\n'> <'\tgrep "first bad commit could be any of" my_bisect_log.txt &&\n'> <'\t! grep $HASH1 my_bisect_log.txt &&\n'> <'\t! grep $HASH2 my_bisect_log.txt &&\n'> <'\tgrep $HASH3 my_bisect_log.txt &&\n'> <'\tgrep $HASH4 my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect skip: with commit both bad and skipped'>)} { (SQ <'\n'> <'\ttest_when_finished git bisect reset &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect skip &&\n'> <'\tgit bisect bad &&\n'> <'\tgit bisect good $HASH1 &&\n'> <'\tgit bisect skip &&\n'> <'\ttest_expect_code 2 git bisect good >my_bisect_log.txt &&\n'> <'\tgrep "first bad commit could be any of" my_bisect_log.txt &&\n'> <'\t! grep $HASH1 my_bisect_log.txt &&\n'> <'\t! grep $HASH2 my_bisect_log.txt &&\n'> <'\tgrep $HASH3 my_bisect_log.txt &&\n'> <'\tgrep $HASH4 my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'"git bisect run" simple case'>)} { (SQ <'echo "#"\\!"/bin/sh" > test_script.sh &&\n'> <' echo "grep Another hello > /dev/null" >> test_script.sh &&\n'> <' echo "test \\$? -ne 0" >> test_script.sh &&\n'> <' chmod +x test_script.sh &&\n'> <' git bisect start &&\n'> <' git bisect good $HASH1 &&\n'> <' git bisect bad $HASH4 &&\n'> <' git bisect run ./test_script.sh > my_bisect_log.txt &&\n'> <' grep "$HASH3 is the first bad commit" my_bisect_log.txt &&\n'> <' git bisect reset'> ) } ) (C {<test_expect_success>} {(SQ <'"git bisect run" with more complex "git bisect start"'>)} { (SQ <'echo "#"\\!"/bin/sh" > test_script.sh &&\n'> <' echo "grep Ciao hello > /dev/null" >> test_script.sh &&\n'> <' echo "test \\$? -ne 0" >> test_script.sh &&\n'> <' chmod +x test_script.sh &&\n'> <' git bisect start $HASH4 $HASH1 &&\n'> <' git bisect run ./test_script.sh > my_bisect_log.txt &&\n'> <' grep "$HASH4 is the first bad commit" my_bisect_log.txt &&\n'> <' git bisect reset'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HASH5) op: assign_op.Equal rhs: (word.Empty) spids: [622] ) ] ) (C {<test_expect_success>} {(SQ <'bisect skip: add line and then a new test'>)} { (SQ <'\n'> <'\tadd_line_into_file "5: Another new line." hello &&\n'> <'\tHASH5=$(git rev-parse --verify HEAD) &&\n'> <'\tgit bisect start $HASH5 $HASH1 &&\n'> <'\tgit bisect skip &&\n'> <'\tgit bisect good > my_bisect_log.txt &&\n'> <'\tgrep "$HASH5 is the first bad commit" my_bisect_log.txt &&\n'> <'\tgit bisect log > log_to_replay.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect skip and bisect replay'>)} { (SQ <'\n'> <'\tgit bisect replay log_to_replay.txt > my_bisect_log.txt &&\n'> <'\tgrep "$HASH5 is the first bad commit" my_bisect_log.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HASH6) op: assign_op.Equal rhs: (word.Empty) spids: [657] ) ] ) (C {<test_expect_success>} {(SQ <'bisect run & skip: cannot tell between 2'>)} { (SQ <'\n'> <'\tadd_line_into_file "6: Yet a line." hello &&\n'> <'\tHASH6=$(git rev-parse --verify HEAD) &&\n'> <'\techo "#"\\!"/bin/sh" > test_script.sh &&\n'> < '\techo "sed -ne \\\\\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&\n' > <'\techo "grep line hello > /dev/null" >> test_script.sh &&\n'> <'\techo "test \\$? -ne 0" >> test_script.sh &&\n'> <'\tchmod +x test_script.sh &&\n'> <'\tgit bisect start $HASH6 $HASH1 &&\n'> <'\tif git bisect run ./test_script.sh > my_bisect_log.txt\n'> <'\tthen\n'> <'\t\techo Oops, should have failed.\n'> <'\t\tfalse\n'> <'\telse\n'> <'\t\ttest $? -eq 2 &&\n'> <'\t\tgrep "first bad commit could be any of" my_bisect_log.txt &&\n'> <'\t\t! grep $HASH3 my_bisect_log.txt &&\n'> <'\t\t! grep $HASH6 my_bisect_log.txt &&\n'> <'\t\tgrep $HASH4 my_bisect_log.txt &&\n'> <'\t\tgrep $HASH5 my_bisect_log.txt\n'> <'\tfi\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HASH7) op: assign_op.Equal rhs: (word.Empty) spids: [690] ) ] ) (C {<test_expect_success>} {(SQ <'bisect run & skip: find first bad'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tadd_line_into_file "7: Should be the last line." hello &&\n'> <'\tHASH7=$(git rev-parse --verify HEAD) &&\n'> <'\techo "#"\\!"/bin/sh" > test_script.sh &&\n'> < '\techo "sed -ne \\\\\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&\n' > <'\techo "sed -ne \\\\\\$p hello | grep day > /dev/null && exit 125" >> test_script.sh &&\n'> <'\techo "grep Yet hello > /dev/null" >> test_script.sh &&\n'> <'\techo "test \\$? -ne 0" >> test_script.sh &&\n'> <'\tchmod +x test_script.sh &&\n'> <'\tgit bisect start $HASH7 $HASH1 &&\n'> <'\tgit bisect run ./test_script.sh > my_bisect_log.txt &&\n'> <'\tgrep "$HASH6 is the first bad commit" my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect skip only one range'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start $HASH7 $HASH1 &&\n'> <'\tgit bisect skip $HASH1..$HASH5 &&\n'> <'\ttest "$HASH6" = "$(git rev-parse --verify HEAD)" &&\n'> <'\ttest_must_fail git bisect bad > my_bisect_log.txt &&\n'> <'\tgrep "first bad commit could be any of" my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect skip many ranges'>)} { (SQ <'\n'> <'\tgit bisect start $HASH7 $HASH1 &&\n'> <'\ttest "$HASH4" = "$(git rev-parse --verify HEAD)" &&\n'> <'\tgit bisect skip $HASH2 $HASH2.. ..$HASH5 &&\n'> <'\ttest "$HASH6" = "$(git rev-parse --verify HEAD)" &&\n'> <'\ttest_must_fail git bisect bad > my_bisect_log.txt &&\n'> <'\tgrep "first bad commit could be any of" my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect starting with a detached HEAD'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit checkout master^ &&\n'> <'\tHEAD=$(git rev-parse --verify HEAD) &&\n'> <'\tgit bisect start &&\n'> <'\ttest $HEAD = $(cat .git/BISECT_START) &&\n'> <'\tgit bisect reset &&\n'> <'\ttest $HEAD = $(git rev-parse --verify HEAD)\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect errors out if bad and good are mistaken'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\ttest_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&\n'> <'\ttest_i18ngrep "mistook good and bad" rev_list_error &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect does not create a "bisect" branch'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start $HASH7 $HASH1 &&\n'> <'\tgit branch bisect &&\n'> <'\trev_hash4=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$rev_hash4" = "$HASH4" &&\n'> <'\tgit branch -D bisect &&\n'> <'\tgit bisect good &&\n'> <'\tgit branch bisect &&\n'> <'\trev_hash6=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$rev_hash6" = "$HASH6" &&\n'> <'\tgit bisect good > my_bisect_log.txt &&\n'> <'\tgrep "$HASH7 is the first bad commit" my_bisect_log.txt &&\n'> <'\tgit bisect reset &&\n'> <'\trev_hash6=$(git rev-parse --verify bisect) &&\n'> <'\ttest "$rev_hash6" = "$HASH6" &&\n'> <'\tgit branch -D bisect\n'> ) } ) (C {<test_expect_success>} {(SQ <'side branch creation'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit checkout -b side $HASH4 &&\n'> <'\tadd_line_into_file "5(side): first line on a side branch" hello2 &&\n'> <'\tSIDE_HASH5=$(git rev-parse --verify HEAD) &&\n'> <'\tadd_line_into_file "6(side): second line on a side branch" hello2 &&\n'> <'\tSIDE_HASH6=$(git rev-parse --verify HEAD) &&\n'> <'\tadd_line_into_file "7(side): third line on a side branch" hello2 &&\n'> <'\tSIDE_HASH7=$(git rev-parse --verify HEAD)\n'> ) } ) (C {<test_expect_success>} {(SQ <'good merge base when good and bad are siblings'>)} { (SQ <'\n'> <'\tgit bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&\n'> <'\ttest_i18ngrep "merge base must be tested" my_bisect_log.txt &&\n'> <'\tgrep $HASH4 my_bisect_log.txt &&\n'> <'\tgit bisect good > my_bisect_log.txt &&\n'> <'\ttest_must_fail grep "merge base must be tested" my_bisect_log.txt &&\n'> <'\tgrep $HASH6 my_bisect_log.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'skipped merge base when good and bad are siblings'>)} { (SQ <'\n'> <'\tgit bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt &&\n'> <'\ttest_i18ngrep "merge base must be tested" my_bisect_log.txt &&\n'> <'\tgrep $HASH4 my_bisect_log.txt &&\n'> <'\tgit bisect skip > my_bisect_log.txt 2>&1 &&\n'> <'\tgrep "warning" my_bisect_log.txt &&\n'> <'\tgrep $SIDE_HASH6 my_bisect_log.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bad merge base when good and bad are siblings'>)} { (SQ <'\n'> <'\tgit bisect start "$HASH7" HEAD > my_bisect_log.txt &&\n'> <'\ttest_i18ngrep "merge base must be tested" my_bisect_log.txt &&\n'> <'\tgrep $HASH4 my_bisect_log.txt &&\n'> <'\ttest_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&\n'> <'\ttest_i18ngrep "merge base $HASH4 is bad" my_bisect_log.txt &&\n'> <'\ttest_i18ngrep "fixed between $HASH4 and \\[$SIDE_HASH7\\]" my_bisect_log.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'many merge bases creation'>)} { (SQ <'\n'> <'\tgit checkout "$SIDE_HASH5" &&\n'> <'\tgit merge -m "merge HASH5 and SIDE_HASH5" "$HASH5" &&\n'> <'\tA_HASH=$(git rev-parse --verify HEAD) &&\n'> <'\tgit checkout side &&\n'> <'\tgit merge -m "merge HASH7 and SIDE_HASH7" "$HASH7" &&\n'> <'\tB_HASH=$(git rev-parse --verify HEAD) &&\n'> <'\tgit merge-base --all "$A_HASH" "$B_HASH" > merge_bases.txt &&\n'> <'\ttest_line_count = 2 merge_bases.txt &&\n'> <'\tgrep "$HASH5" merge_bases.txt &&\n'> <'\tgrep "$SIDE_HASH5" merge_bases.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'good merge bases when good and bad are siblings'>)} { (SQ <'\n'> <'\tgit bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt &&\n'> <'\ttest_i18ngrep "merge base must be tested" my_bisect_log.txt &&\n'> <'\tgit bisect good > my_bisect_log2.txt &&\n'> <'\ttest_i18ngrep "merge base must be tested" my_bisect_log2.txt &&\n'> <'\t{\n'> <'\t\t{\n'> <'\t\t\tgrep "$SIDE_HASH5" my_bisect_log.txt &&\n'> <'\t\t\tgrep "$HASH5" my_bisect_log2.txt\n'> <'\t\t} || {\n'> <'\t\t\tgrep "$SIDE_HASH5" my_bisect_log2.txt &&\n'> <'\t\t\tgrep "$HASH5" my_bisect_log.txt\n'> <'\t\t}\n'> <'\t} &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'optimized merge base checks'>)} { (SQ <'\n'> <'\tgit bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&\n'> <'\ttest_i18ngrep "merge base must be tested" my_bisect_log.txt &&\n'> <'\tgrep "$HASH4" my_bisect_log.txt &&\n'> <'\tgit bisect good > my_bisect_log2.txt &&\n'> <'\ttest -f ".git/BISECT_ANCESTORS_OK" &&\n'> <'\ttest "$HASH6" = $(git rev-parse --verify HEAD) &&\n'> <'\tgit bisect bad > my_bisect_log3.txt &&\n'> <'\tgit bisect good "$A_HASH" > my_bisect_log4.txt &&\n'> <'\ttest_i18ngrep "merge base must be tested" my_bisect_log4.txt &&\n'> <'\ttest_must_fail test -f ".git/BISECT_ANCESTORS_OK"\n'> ) } ) (C {<test_expect_success>} {(SQ <'"parallel" side branch creation'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit checkout -b parallel $HASH1 &&\n'> <'\tmkdir dir1 dir2 &&\n'> <'\tadd_line_into_file "1(para): line 1 on parallel branch" dir1/file1 &&\n'> <'\tPARA_HASH1=$(git rev-parse --verify HEAD) &&\n'> <'\tadd_line_into_file "2(para): line 2 on parallel branch" dir2/file2 &&\n'> <'\tPARA_HASH2=$(git rev-parse --verify HEAD) &&\n'> <'\tadd_line_into_file "3(para): line 3 on parallel branch" dir2/file3 &&\n'> <'\tPARA_HASH3=$(git rev-parse --verify HEAD) &&\n'> <'\tgit merge -m "merge HASH4 and PARA_HASH3" "$HASH4" &&\n'> <'\tPARA_HASH4=$(git rev-parse --verify HEAD) &&\n'> <'\tadd_line_into_file "5(para): add line on parallel branch" dir1/file1 &&\n'> <'\tPARA_HASH5=$(git rev-parse --verify HEAD) &&\n'> <'\tadd_line_into_file "6(para): add line on parallel branch" dir2/file2 &&\n'> <'\tPARA_HASH6=$(git rev-parse --verify HEAD) &&\n'> <'\tgit merge -m "merge HASH7 and PARA_HASH6" "$HASH7" &&\n'> <'\tPARA_HASH7=$(git rev-parse --verify HEAD)\n'> ) } ) (C {<test_expect_success>} {(SQ <'restricting bisection on one dir'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start HEAD $HASH1 -- dir1 &&\n'> <'\tpara1=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$para1" = "$PARA_HASH1" &&\n'> <'\tgit bisect bad > my_bisect_log.txt &&\n'> <'\tgrep "$PARA_HASH1 is the first bad commit" my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'restricting bisection on one dir and a file'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start HEAD $HASH1 -- dir1 hello &&\n'> <'\tpara4=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$para4" = "$PARA_HASH4" &&\n'> <'\tgit bisect bad &&\n'> <'\thash3=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$hash3" = "$HASH3" &&\n'> <'\tgit bisect good &&\n'> <'\thash4=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$hash4" = "$HASH4" &&\n'> <'\tgit bisect good &&\n'> <'\tpara1=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$para1" = "$PARA_HASH1" &&\n'> <'\tgit bisect good > my_bisect_log.txt &&\n'> <'\tgrep "$PARA_HASH4 is the first bad commit" my_bisect_log.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'skipping away from skipped commit'>)} { (SQ <'\n'> <'\tgit bisect start $PARA_HASH7 $HASH1 &&\n'> <'\tpara4=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$para4" = "$PARA_HASH4" &&\n'> <' git bisect skip &&\n'> <'\thash7=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$hash7" = "$HASH7" &&\n'> <' git bisect skip &&\n'> <'\tpara3=$(git rev-parse --verify HEAD) &&\n'> <'\ttest "$para3" = "$PARA_HASH3"\n'> ) } ) (C {<test_expect_success>} {(SQ <'erroring out when using bad path parameters'>)} { (SQ <'\n'> <'\ttest_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&\n'> <'\ttest_i18ngrep "bad path parameters" error.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'test bisection on bare repo - --no-checkout specified'>)} { (SQ <'\n'> <'\tgit clone --bare . bare.nocheckout &&\n'> <'\t(\n'> <'\t\tcd bare.nocheckout &&\n'> <'\t\tgit bisect start --no-checkout &&\n'> <'\t\tgit bisect good $HASH1 &&\n'> <'\t\tgit bisect bad $HASH4 &&\n'> <'\t\tgit bisect run eval \\\n'> <'\t\t\t"test \\$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \\\n'> <'\t\t\t>../nocheckout.log\n'> <'\t) &&\n'> <'\tgrep "$HASH3 is the first bad commit" nocheckout.log\n'> ) } ) (C {<test_expect_success>} {(SQ <'test bisection on bare repo - --no-checkout defaulted'>)} { (SQ <'\n'> <'\tgit clone --bare . bare.defaulted &&\n'> <'\t(\n'> <'\t\tcd bare.defaulted &&\n'> <'\t\tgit bisect start &&\n'> <'\t\tgit bisect good $HASH1 &&\n'> <'\t\tgit bisect bad $HASH4 &&\n'> <'\t\tgit bisect run eval \\\n'> <'\t\t\t"test \\$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \\\n'> <'\t\t\t>../defaulted.log\n'> <'\t) &&\n'> <'\tgrep "$HASH3 is the first bad commit" defaulted.log\n'> ) } ) (C {<test_expect_success>} {(SQ <'broken branch creation'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit checkout -b broken $HASH4 &&\n'> <'\tgit tag BROKEN_HASH4 $HASH4 &&\n'> <'\tadd_line_into_file "5(broken): first line on a broken branch" hello2 &&\n'> <'\tgit tag BROKEN_HASH5 &&\n'> <'\tmkdir missing &&\n'> <'\t:> missing/MISSING &&\n'> <'\tgit add missing/MISSING &&\n'> <'\tgit commit -m "6(broken): Added file that will be deleted" &&\n'> <'\tgit tag BROKEN_HASH6 &&\n'> <'\tadd_line_into_file "7(broken): second line on a broken branch" hello2 &&\n'> <'\tgit tag BROKEN_HASH7 &&\n'> <'\tadd_line_into_file "8(broken): third line on a broken branch" hello2 &&\n'> <'\tgit tag BROKEN_HASH8 &&\n'> <'\tgit rm missing/MISSING &&\n'> <'\tgit commit -m "9(broken): Remove missing file" &&\n'> <'\tgit tag BROKEN_HASH9 &&\n'> <'\trm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d\n'> ) } ) (command.Simple words: [{<echo>} {(DQ )}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected.ok>})] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expected.missing-tree.default>} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {<EOF>} here_end_span_id: 1275 stdin_parts: [<'fatal: unable to read tree 39f7e61a724187ab767d2e08442d9b6b9dab587d\n'>] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'bisect fails if tree is broken on start commit'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\ttest_must_fail git bisect start BROKEN_HASH7 BROKEN_HASH4 2>error.txt &&\n'> <'\ttest_cmp expected.missing-tree.default error.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect fails if tree is broken on trial commit'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\ttest_must_fail git bisect start BROKEN_HASH9 BROKEN_HASH4 2>error.txt &&\n'> <'\tgit reset --hard broken &&\n'> <'\tgit checkout broken &&\n'> <'\ttest_cmp expected.missing-tree.default error.txt\n'> ) } ) (command.ShFunction name: check_same body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<echo>} { (DQ <'Checking '> ($ Id.VSub_Number '$1') <' is the same as '> ($ Id.VSub_Number '$2') ) } ) (C {<test_cmp_rev>} {(DQ ($ Id.VSub_Number '$1'))} {(DQ ($ Id.VSub_Number '$2'))}) ] ) ] ) ) (C {<test_expect_success>} {(SQ <'bisect: --no-checkout - start commit bad'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start BROKEN_HASH7 BROKEN_HASH4 --no-checkout &&\n'> <'\tcheck_same BROKEN_HASH6 BISECT_HEAD &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect: --no-checkout - trial commit bad'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start broken BROKEN_HASH4 --no-checkout &&\n'> <'\tcheck_same BROKEN_HASH6 BISECT_HEAD &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect: --no-checkout - target before breakage'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start broken BROKEN_HASH4 --no-checkout &&\n'> <'\tcheck_same BROKEN_HASH6 BISECT_HEAD &&\n'> <'\tgit bisect bad BISECT_HEAD &&\n'> <'\tcheck_same BROKEN_HASH5 BISECT_HEAD &&\n'> <'\tgit bisect bad BISECT_HEAD &&\n'> <'\tcheck_same BROKEN_HASH5 bisect/bad &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect: --no-checkout - target in breakage'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start broken BROKEN_HASH4 --no-checkout &&\n'> <'\tcheck_same BROKEN_HASH6 BISECT_HEAD &&\n'> <'\tgit bisect bad BISECT_HEAD &&\n'> <'\tcheck_same BROKEN_HASH5 BISECT_HEAD &&\n'> <'\tgit bisect good BISECT_HEAD &&\n'> <'\tcheck_same BROKEN_HASH6 bisect/bad &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect: --no-checkout - target after breakage'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start broken BROKEN_HASH4 --no-checkout &&\n'> <'\tcheck_same BROKEN_HASH6 BISECT_HEAD &&\n'> <'\tgit bisect good BISECT_HEAD &&\n'> <'\tcheck_same BROKEN_HASH8 BISECT_HEAD &&\n'> <'\tgit bisect good BISECT_HEAD &&\n'> <'\tcheck_same BROKEN_HASH9 bisect/bad &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect: demonstrate identification of damage boundary'>)} { (DQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit checkout broken &&\n'> <'\tgit bisect start broken master --no-checkout &&\n'> <'\tgit bisect run '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <SHELL_PATH> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' -c \'\n'> <'\t\tGOOD='> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'(git for-each-ref '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <'--format=%(objectname)'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' refs/bisect/good-*) &&\n'> <'\t\tgit rev-list --objects BISECT_HEAD --not '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'GOOD >tmp.'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <' &&\n'> <'\t\tgit pack-objects --stdout >/dev/null < tmp.'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'\n'> <'\t\trc='> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'?\n'> <'\t\trm -f tmp.'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'\n'> <'\t\ttest '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'rc = 0\' &&\n'> <'\tcheck_same BROKEN_HASH6 bisect/bad &&\n'> <'\tgit bisect reset\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected.bisect-log>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {<EOF>} here_end_span_id: 1491 stdin_parts: [ < '# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.\n' > < '# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into <hello>.\n' > < 'git bisect start \'32a594a3fdac2d57cf6d02987e30eec68511498c\' \'7b7f204a749c3125d5224ed61ea2ae1187ad046f\'\n' > < '# good: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.\n' > <'git bisect good 3de952f2416b6084f557ec417709eac740c6818c\n'> < '# first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.\n' > ] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'bisect log: successful result'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start $HASH4 $HASH2 &&\n'> <'\tgit bisect good &&\n'> <'\tgit bisect log >bisect-log.txt &&\n'> <'\ttest_cmp expected.bisect-log bisect-log.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expected.bisect-skip-log>} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {<EOF>} here_end_span_id: 1528 stdin_parts: [ < '# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.\n' > < '# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into <hello>.\n' > < 'git bisect start \'32a594a3fdac2d57cf6d02987e30eec68511498c\' \'7b7f204a749c3125d5224ed61ea2ae1187ad046f\'\n' > < '# skip: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.\n' > <'git bisect skip 3de952f2416b6084f557ec417709eac740c6818c\n'> <'# only skipped commits left to test\n'> < '# possible first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.\n' > < '# possible first bad commit: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.\n' > ] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'bisect log: only skip commits left'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start $HASH4 $HASH2 &&\n'> <'\ttest_must_fail git bisect skip &&\n'> <'\tgit bisect log >bisect-skip-log.txt &&\n'> <'\ttest_cmp expected.bisect-skip-log bisect-skip-log.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'"git bisect bad HEAD" behaves as "git bisect bad"'>)} { (SQ <'\n'> <'\tgit checkout parallel &&\n'> <'\tgit bisect start HEAD $HASH1 &&\n'> <'\tgit bisect good HEAD &&\n'> <'\tgit bisect bad HEAD &&\n'> <'\ttest "$HASH6" = $(git rev-parse --verify HEAD) &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect starts with only one new'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect new $HASH4 &&\n'> <'\tgit bisect next\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect does not start with only one old'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect old $HASH1 &&\n'> <'\ttest_must_fail git bisect next\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start with one new and old'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start &&\n'> <'\tgit bisect old $HASH1 &&\n'> <'\tgit bisect new $HASH4 &&\n'> <'\tgit bisect new &&\n'> <'\tgit bisect new >bisect_result &&\n'> <'\tgrep "$HASH2 is the first new commit" bisect_result &&\n'> <'\tgit bisect log >log_to_replay.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect replay with old and new'>)} { (SQ <'\n'> <'\tgit bisect replay log_to_replay.txt >bisect_result &&\n'> <'\tgrep "$HASH2 is the first new commit" bisect_result &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect cannot mix old/new and good/bad'>)} { (SQ <'\n'> <'\tgit bisect start &&\n'> <'\tgit bisect bad $HASH4 &&\n'> <'\ttest_must_fail git bisect old $HASH1\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect terms needs 0 or 1 argument'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\ttest_must_fail git bisect terms only-one &&\n'> <'\ttest_must_fail git bisect terms 1 2 &&\n'> <'\ttest_must_fail git bisect terms 2>actual &&\n'> <'\techo "no terms defined" >expected &&\n'> <'\ttest_i18ncmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect terms shows good/bad after start'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start HEAD $HASH1 &&\n'> <'\tgit bisect terms --term-good >actual &&\n'> <'\techo good >expected &&\n'> <'\ttest_cmp expected actual &&\n'> <'\tgit bisect terms --term-bad >actual &&\n'> <'\techo bad >expected &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start with one term1 and term2'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start --term-old term2 --term-new term1 &&\n'> <'\tgit bisect term2 $HASH1 &&\n'> <'\tgit bisect term1 $HASH4 &&\n'> <'\tgit bisect term1 &&\n'> <'\tgit bisect term1 >bisect_result &&\n'> <'\tgrep "$HASH2 is the first term1 commit" bisect_result &&\n'> <'\tgit bisect log >log_to_replay.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect replay with term1 and term2'>)} { (SQ <'\n'> <'\tgit bisect replay log_to_replay.txt >bisect_result &&\n'> <'\tgrep "$HASH2 is the first term1 commit" bisect_result &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start term1 term2'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start --term-new term1 --term-old term2 $HASH4 $HASH1 &&\n'> <'\tgit bisect term1 &&\n'> <'\tgit bisect term1 >bisect_result &&\n'> <'\tgrep "$HASH2 is the first term1 commit" bisect_result &&\n'> <'\tgit bisect log >log_to_replay.txt &&\n'> <'\tgit bisect reset\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect cannot mix terms'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start --term-good term1 --term-bad term2 $HASH4 $HASH1 &&\n'> <'\ttest_must_fail git bisect a &&\n'> <'\ttest_must_fail git bisect b &&\n'> <'\ttest_must_fail git bisect bad &&\n'> <'\ttest_must_fail git bisect good &&\n'> <'\ttest_must_fail git bisect new &&\n'> <'\ttest_must_fail git bisect old\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect terms rejects invalid terms'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\ttest_must_fail git bisect start --term-good invalid..term &&\n'> <'\ttest_must_fail git bisect terms --term-bad invalid..term &&\n'> <'\ttest_must_fail git bisect terms --term-good bad &&\n'> <'\ttest_must_fail git bisect terms --term-good old &&\n'> <'\ttest_must_fail git bisect terms --term-good skip &&\n'> <'\ttest_must_fail git bisect terms --term-good reset &&\n'> <'\ttest_path_is_missing .git/BISECT_TERMS\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start --term-* does store terms'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start --term-bad=one --term-good=two &&\n'> <'\tgit bisect terms >actual &&\n'> <'\tcat <<-EOF >expected &&\n'> <'\tYour current terms are two for the old state\n'> <'\tand one for the new state.\n'> <'\tEOF\n'> <'\ttest_i18ncmp expected actual &&\n'> <'\tgit bisect terms --term-bad >actual &&\n'> <'\techo one >expected &&\n'> <'\ttest_cmp expected actual &&\n'> <'\tgit bisect terms --term-good >actual &&\n'> <'\techo two >expected &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'bisect start takes options and revs in any order'>)} { (SQ <'\n'> <'\tgit bisect reset &&\n'> <'\tgit bisect start --term-good one $HASH4 \\\n'> <'\t\t--term-good two --term-bad bad-term \\\n'> <'\t\t$HASH1 --term-good three -- &&\n'> <'\t(git bisect terms --term-bad && git bisect terms --term-good) >actual &&\n'> <'\tprintf "%s\\n%s\\n" bad-term three >expected &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_done>}) ] )