Imported Upstream version 2.20.2
[platform/upstream/git.git] / t / t6030-bisect-porcelain.sh
index e74662b..f84ff94 100755 (executable)
@@ -362,7 +362,7 @@ test_expect_success 'bisect starting with a detached HEAD' '
 test_expect_success 'bisect errors out if bad and good are mistaken' '
        git bisect reset &&
        test_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&
-       grep "mistook good and bad" rev_list_error &&
+       test_i18ngrep "mistook good and bad" rev_list_error &&
        git bisect reset
 '
 
@@ -404,16 +404,16 @@ test_expect_success 'side branch creation' '
 
 test_expect_success 'good merge base when good and bad are siblings' '
        git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
-       grep "merge base must be tested" my_bisect_log.txt &&
+       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
        grep $HASH4 my_bisect_log.txt &&
        git bisect good > my_bisect_log.txt &&
-       test_must_fail grep "merge base must be tested" my_bisect_log.txt &&
+       ! grep "merge base must be tested" my_bisect_log.txt &&
        grep $HASH6 my_bisect_log.txt &&
        git bisect reset
 '
 test_expect_success 'skipped merge base when good and bad are siblings' '
        git bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt &&
-       grep "merge base must be tested" my_bisect_log.txt &&
+       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
        grep $HASH4 my_bisect_log.txt &&
        git bisect skip > my_bisect_log.txt 2>&1 &&
        grep "warning" my_bisect_log.txt &&
@@ -423,11 +423,11 @@ test_expect_success 'skipped merge base when good and bad are siblings' '
 
 test_expect_success 'bad merge base when good and bad are siblings' '
        git bisect start "$HASH7" HEAD > my_bisect_log.txt &&
-       grep "merge base must be tested" my_bisect_log.txt &&
+       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
        grep $HASH4 my_bisect_log.txt &&
        test_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&
-       grep "merge base $HASH4 is bad" my_bisect_log.txt &&
-       grep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
+       test_i18ngrep "merge base $HASH4 is bad" my_bisect_log.txt &&
+       test_i18ngrep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
        git bisect reset
 '
 
@@ -460,9 +460,9 @@ test_expect_success 'many merge bases creation' '
 
 test_expect_success 'good merge bases when good and bad are siblings' '
        git bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt &&
-       grep "merge base must be tested" my_bisect_log.txt &&
+       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
        git bisect good > my_bisect_log2.txt &&
-       grep "merge base must be tested" my_bisect_log2.txt &&
+       test_i18ngrep "merge base must be tested" my_bisect_log2.txt &&
        {
                {
                        grep "$SIDE_HASH5" my_bisect_log.txt &&
@@ -477,14 +477,14 @@ test_expect_success 'good merge bases when good and bad are siblings' '
 
 test_expect_success 'optimized merge base checks' '
        git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
-       grep "merge base must be tested" my_bisect_log.txt &&
+       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
        grep "$HASH4" my_bisect_log.txt &&
        git bisect good > my_bisect_log2.txt &&
        test -f ".git/BISECT_ANCESTORS_OK" &&
        test "$HASH6" = $(git rev-parse --verify HEAD) &&
        git bisect bad > my_bisect_log3.txt &&
        git bisect good "$A_HASH" > my_bisect_log4.txt &&
-       grep "merge base must be tested" my_bisect_log4.txt &&
+       test_i18ngrep "merge base must be tested" my_bisect_log4.txt &&
        test_must_fail test -f ".git/BISECT_ANCESTORS_OK"
 '
 
@@ -562,7 +562,7 @@ test_expect_success 'skipping away from skipped commit' '
 
 test_expect_success 'erroring out when using bad path parameters' '
        test_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&
-       grep "bad path parameters" error.txt
+       test_i18ngrep "bad path parameters" error.txt
 '
 
 test_expect_success 'test bisection on bare repo - --no-checkout specified' '
@@ -721,7 +721,7 @@ git bisect good 3de952f2416b6084f557ec417709eac740c6818c
 # first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
 EOF
 
-test_expect_success 'bisect log: successfull result' '
+test_expect_success 'bisect log: successful result' '
        git bisect reset &&
        git bisect start $HASH4 $HASH2 &&
        git bisect good &&
@@ -803,7 +803,7 @@ test_expect_success 'bisect terms needs 0 or 1 argument' '
        test_must_fail git bisect terms 1 2 &&
        test_must_fail git bisect terms 2>actual &&
        echo "no terms defined" >expected &&
-       test_cmp expected actual
+       test_i18ncmp expected actual
 '
 
 test_expect_success 'bisect terms shows good/bad after start' '
@@ -875,7 +875,7 @@ test_expect_success 'bisect start --term-* does store terms' '
        Your current terms are two for the old state
        and one for the new state.
        EOF
-       test_cmp expected actual &&
+       test_i18ncmp expected actual &&
        git bisect terms --term-bad >actual &&
        echo one >expected &&
        test_cmp expected actual &&
@@ -894,4 +894,21 @@ test_expect_success 'bisect start takes options and revs in any order' '
        test_cmp expected actual
 '
 
+test_expect_success 'git bisect reset cleans bisection state properly' '
+       git bisect reset &&
+       git bisect start &&
+       git bisect good $HASH1 &&
+       git bisect bad $HASH4 &&
+       git bisect reset &&
+       test -z "$(git for-each-ref "refs/bisect/*")" &&
+       test_path_is_missing "$GIT_DIR/BISECT_EXPECTED_REV" &&
+       test_path_is_missing "$GIT_DIR/BISECT_ANCESTORS_OK" &&
+       test_path_is_missing "$GIT_DIR/BISECT_LOG" &&
+       test_path_is_missing "$GIT_DIR/BISECT_RUN" &&
+       test_path_is_missing "$GIT_DIR/BISECT_TERMS" &&
+       test_path_is_missing "$GIT_DIR/head-name" &&
+       test_path_is_missing "$GIT_DIR/BISECT_HEAD" &&
+       test_path_is_missing "$GIT_DIR/BISECT_START"
+'
+
 test_done