817
test_cmp expected actual
818
'
819
820
+test_expect_success 'bisect start with one term1 and term2' '
821
+ git bisect reset &&
822
+ git bisect start --term-old term2 --term-new term1 &&
823
+ git bisect term2 $HASH1 &&
824
+ git bisect term1 $HASH4 &&
825
+ git bisect term1 &&
826
+ git bisect term1 >bisect_result &&
827
+ grep "$HASH2 is the first term1 commit" bisect_result &&
828
+ git bisect log >log_to_replay.txt &&
829
+ git bisect reset
830
+'
831
+
832
+test_expect_success 'bisect replay with term1 and term2' '
833
+ git bisect replay log_to_replay.txt >bisect_result &&
834
+ grep "$HASH2 is the first term1 commit" bisect_result &&
835
+ git bisect reset
836
+'
837
+
838
+test_expect_success 'bisect start term1 term2' '
839
+ git bisect reset &&
840
+ git bisect start --term-new term1 --term-old term2 $HASH4 $HASH1 &&
841
+ git bisect term1 &&
842
+ git bisect term1 >bisect_result &&
843
+ grep "$HASH2 is the first term1 commit" bisect_result &&
844
+ git bisect log >log_to_replay.txt &&
845
+ git bisect reset
846
+'
847
+
848
+test_expect_success 'bisect cannot mix terms' '
849
+ git bisect reset &&
850
+ git bisect start --term-good term1 --term-bad term2 $HASH4 $HASH1 &&
851
+ test_must_fail git bisect a &&
852
+ test_must_fail git bisect b &&
853
+ test_must_fail git bisect bad &&
854
+ test_must_fail git bisect good &&
855
+ test_must_fail git bisect new &&
856
+ test_must_fail git bisect old
857
+'
858
+
859
+test_expect_success 'bisect terms rejects invalid terms' '
860
+ git bisect reset &&
861
+ test_must_fail git bisect start --term-good invalid..term &&
862
+ test_must_fail git bisect terms --term-bad invalid..term &&
863
+ test_must_fail git bisect terms --term-good bad &&
864
+ test_must_fail git bisect terms --term-good old &&
865
+ test_must_fail git bisect terms --term-good skip &&
866
+ test_must_fail git bisect terms --term-good reset &&
867
+ test_path_is_missing .git/BISECT_TERMS
868
+'
869
+
870
+test_expect_success 'bisect start --term-* does store terms' '
871
+ git bisect reset &&
872
+ git bisect start --term-bad=one --term-good=two &&
873
+ git bisect terms >actual &&
874
+ cat <<-EOF >expected &&
875
+ Your current terms are two for the old state
876
+ and one for the new state.
877
+ EOF
878
+ test_cmp expected actual &&
879
+ git bisect terms --term-bad >actual &&
880
+ echo one >expected &&
881
+ test_cmp expected actual &&
882
+ git bisect terms --term-good >actual &&
883
+ echo two >expected &&
884
+ test_cmp expected actual
885
+'
886
+
887
+test_expect_success 'bisect start takes options and revs in any order' '
888
+ git bisect reset &&
889
+ git bisect start --term-good one $HASH4 \
890
+ --term-good two --term-bad bad-term \
891
+ $HASH1 --term-good three -- &&
892
+ (git bisect terms --term-bad && git bisect terms --term-good) >actual &&
893
+ printf "%s\n%s\n" bad-term three >expected &&
894
+ test_cmp expected actual
895
+'
896
+
897
test_done