@@ -126,6 +126,18 @@ test_expect_success 'bisect reset removes packed refs' '
126
126
test -z "$(git for-each-ref "refs/heads/bisect")"
127
127
'
128
128
129
+ test_expect_success ' bisect reset removes bisect state after --no-checkout' '
130
+ git bisect reset &&
131
+ git bisect start --no-checkout &&
132
+ git bisect good $HASH1 &&
133
+ git bisect bad $HASH3 &&
134
+ git bisect next &&
135
+ git bisect reset &&
136
+ test -z "$(git for-each-ref "refs/bisect/*")" &&
137
+ test -z "$(git for-each-ref "refs/heads/bisect")" &&
138
+ test -z "$(git for-each-ref "BISECT_HEAD")"
139
+ '
140
+
129
141
test_expect_success ' bisect start: back in good branch' '
130
142
git branch > branch.output &&
131
143
grep "* other" branch.output > /dev/null &&
@@ -630,4 +642,74 @@ test_expect_success 'bisect fails if tree is broken on trial commit' '
630
642
test_cmp expected.missing-tree.default error.txt
631
643
'
632
644
645
+ check_same ()
646
+ {
647
+ echo " Checking $1 is the same as $2 " &&
648
+ git rev-parse " $1 " > expected.same &&
649
+ git rev-parse " $2 " > expected.actual &&
650
+ test_cmp expected.same expected.actual
651
+ }
652
+
653
+ test_expect_success ' bisect: --no-checkout - start commit bad' '
654
+ git bisect reset &&
655
+ git bisect start BROKEN_HASH7 BROKEN_HASH4 --no-checkout &&
656
+ check_same BROKEN_HASH6 BISECT_HEAD &&
657
+ git bisect reset
658
+ '
659
+
660
+ test_expect_success ' bisect: --no-checkout - trial commit bad' '
661
+ git bisect reset &&
662
+ git bisect start broken BROKEN_HASH4 --no-checkout &&
663
+ check_same BROKEN_HASH6 BISECT_HEAD &&
664
+ git bisect reset
665
+ '
666
+
667
+ test_expect_success ' bisect: --no-checkout - target before breakage' '
668
+ git bisect reset &&
669
+ git bisect start broken BROKEN_HASH4 --no-checkout &&
670
+ check_same BROKEN_HASH6 BISECT_HEAD &&
671
+ git bisect bad BISECT_HEAD &&
672
+ check_same BROKEN_HASH5 BISECT_HEAD &&
673
+ git bisect bad BISECT_HEAD &&
674
+ check_same BROKEN_HASH5 bisect/bad &&
675
+ git bisect reset
676
+ '
677
+
678
+ test_expect_success ' bisect: --no-checkout - target in breakage' '
679
+ git bisect reset &&
680
+ git bisect start broken BROKEN_HASH4 --no-checkout &&
681
+ check_same BROKEN_HASH6 BISECT_HEAD &&
682
+ git bisect bad BISECT_HEAD &&
683
+ check_same BROKEN_HASH5 BISECT_HEAD &&
684
+ git bisect good BISECT_HEAD &&
685
+ check_same BROKEN_HASH6 bisect/bad &&
686
+ git bisect reset
687
+ '
688
+
689
+ test_expect_success ' bisect: --no-checkout - target after breakage' '
690
+ git bisect reset &&
691
+ git bisect start broken BROKEN_HASH4 --no-checkout &&
692
+ check_same BROKEN_HASH6 BISECT_HEAD &&
693
+ git bisect good BISECT_HEAD &&
694
+ check_same BROKEN_HASH8 BISECT_HEAD &&
695
+ git bisect good BISECT_HEAD &&
696
+ check_same BROKEN_HASH9 bisect/bad &&
697
+ git bisect reset
698
+ '
699
+
700
+ test_expect_success ' bisect: demonstrate identification of damage boundary' "
701
+ git bisect reset &&
702
+ git checkout broken &&
703
+ git bisect start broken master --no-checkout &&
704
+ git bisect run sh -c '
705
+ GOOD=\$ (git for-each-ref \" --format=%(objectname)\" refs/bisect/good-*) &&
706
+ git rev-list --objects BISECT_HEAD --not \$ GOOD >tmp.\$\$ &&
707
+ git pack-objects --stdout >/dev/null < tmp.\$\$
708
+ rc=\$ ?
709
+ rm -f tmp.\$\$
710
+ test \$ rc = 0' &&
711
+ check_same BROKEN_HASH6 bisect/bad &&
712
+ git bisect reset
713
+ "
714
+
633
715
test_done
0 commit comments