Merge branch 'ab/i18n-test-fix'
authorJunio C Hamano <gitster@pobox.com>
Mon, 7 Nov 2011 05:22:22 +0000 (21:22 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Nov 2011 05:22:22 +0000 (21:22 -0800)
* ab/i18n-test-fix:
t/t7508-status.sh: use test_i18ncmp
t/t6030-bisect-porcelain.sh: use test_i18ngrep

1  2 
t/t6030-bisect-porcelain.sh
index c6f1f9f8ab2353ec81401828f8500cb7c1a869fb,d13fdc84cda9a1d0b3d5fab7d48c91859f14b9b4..691e4a4481eba2994ec40e498d4cd25fcff67f26
@@@ -126,18 -126,6 +126,18 @@@ test_expect_success 'bisect reset remov
        test -z "$(git for-each-ref "refs/heads/bisect")"
  '
  
 +test_expect_success 'bisect reset removes bisect state after --no-checkout' '
 +      git bisect reset &&
 +      git bisect start --no-checkout &&
 +      git bisect good $HASH1 &&
 +      git bisect bad $HASH3 &&
 +      git bisect next &&
 +      git bisect reset &&
 +      test -z "$(git for-each-ref "refs/bisect/*")" &&
 +      test -z "$(git for-each-ref "refs/heads/bisect")" &&
 +      test -z "$(git for-each-ref "BISECT_HEAD")"
 +'
 +
  test_expect_success 'bisect start: back in good branch' '
        git branch > branch.output &&
        grep "* other" branch.output > /dev/null &&
@@@ -164,7 -152,7 +164,7 @@@ test_expect_success 'bisect start: exis
        cp .git/BISECT_START saved &&
        test_must_fail git bisect start $HASH4 foo -- &&
        git branch > branch.output &&
-       grep "* (no branch)" branch.output > /dev/null &&
+       test_i18ngrep "* (no branch)" branch.output > /dev/null &&
        test_cmp saved .git/BISECT_START
  '
  test_expect_success 'bisect start: no ".git/BISECT_START" if mistaken rev' '
@@@ -592,155 -580,6 +592,155 @@@ test_expect_success 'erroring out when 
        grep "bad path parameters" error.txt
  '
  
 +test_expect_success 'test bisection on bare repo - --no-checkout specified' '
 +      git clone --bare . bare.nocheckout &&
 +      (
 +              cd bare.nocheckout &&
 +              git bisect start --no-checkout &&
 +              git bisect good $HASH1 &&
 +              git bisect bad $HASH4 &&
 +              git bisect run eval \
 +                      "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
 +                      >../nocheckout.log &&
 +              git bisect reset
 +      ) &&
 +      grep "$HASH3 is the first bad commit" nocheckout.log
 +'
 +
 +
 +test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '
 +      git clone --bare . bare.defaulted &&
 +      (
 +              cd bare.defaulted &&
 +              git bisect start &&
 +              git bisect good $HASH1 &&
 +              git bisect bad $HASH4 &&
 +              git bisect run eval \
 +                      "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
 +                      >../defaulted.log &&
 +              git bisect reset
 +      ) &&
 +      grep "$HASH3 is the first bad commit" defaulted.log
 +'
 +
  #
 +# This creates a broken branch which cannot be checked out because
 +# the tree created has been deleted.
  #
 +# H1-H2-H3-H4-H5-H6-H7  <--other
 +#            \
 +#             S5-S6'-S7'-S8'-S9  <--broken
 +#
 +# Commits marked with ' have a missing tree.
 +#
 +test_expect_success 'broken branch creation' '
 +      git bisect reset &&
 +      git checkout -b broken $HASH4 &&
 +      git tag BROKEN_HASH4 $HASH4 &&
 +      add_line_into_file "5(broken): first line on a broken branch" hello2 &&
 +      git tag BROKEN_HASH5 &&
 +      mkdir missing &&
 +      :> missing/MISSING &&
 +      git add missing/MISSING &&
 +      git commit -m "6(broken): Added file that will be deleted"
 +      git tag BROKEN_HASH6 &&
 +      add_line_into_file "7(broken): second line on a broken branch" hello2 &&
 +      git tag BROKEN_HASH7 &&
 +      add_line_into_file "8(broken): third line on a broken branch" hello2 &&
 +      git tag BROKEN_HASH8 &&
 +      git rm missing/MISSING &&
 +      git commit -m "9(broken): Remove missing file"
 +      git tag BROKEN_HASH9 &&
 +      rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d
 +'
 +
 +echo "" > expected.ok
 +cat > expected.missing-tree.default <<EOF
 +fatal: unable to read tree 39f7e61a724187ab767d2e08442d9b6b9dab587d
 +EOF
 +
 +test_expect_success 'bisect fails if tree is broken on start commit' '
 +      git bisect reset &&
 +      test_must_fail git bisect start BROKEN_HASH7 BROKEN_HASH4 2>error.txt &&
 +      test_cmp expected.missing-tree.default error.txt
 +'
 +
 +test_expect_success 'bisect fails if tree is broken on trial commit' '
 +      git bisect reset &&
 +      test_must_fail git bisect start BROKEN_HASH9 BROKEN_HASH4 2>error.txt &&
 +      git reset --hard broken &&
 +      git checkout broken &&
 +      test_cmp expected.missing-tree.default error.txt
 +'
 +
 +check_same()
 +{
 +      echo "Checking $1 is the same as $2" &&
 +      git rev-parse "$1" > expected.same &&
 +      git rev-parse "$2" > expected.actual &&
 +      test_cmp expected.same expected.actual
 +}
 +
 +test_expect_success 'bisect: --no-checkout - start commit bad' '
 +      git bisect reset &&
 +      git bisect start BROKEN_HASH7 BROKEN_HASH4 --no-checkout &&
 +      check_same BROKEN_HASH6 BISECT_HEAD &&
 +      git bisect reset
 +'
 +
 +test_expect_success 'bisect: --no-checkout - trial commit bad' '
 +      git bisect reset &&
 +      git bisect start broken BROKEN_HASH4 --no-checkout &&
 +      check_same BROKEN_HASH6 BISECT_HEAD &&
 +      git bisect reset
 +'
 +
 +test_expect_success 'bisect: --no-checkout - target before breakage' '
 +      git bisect reset &&
 +      git bisect start broken BROKEN_HASH4 --no-checkout &&
 +      check_same BROKEN_HASH6 BISECT_HEAD &&
 +      git bisect bad BISECT_HEAD &&
 +      check_same BROKEN_HASH5 BISECT_HEAD &&
 +      git bisect bad BISECT_HEAD &&
 +      check_same BROKEN_HASH5 bisect/bad &&
 +      git bisect reset
 +'
 +
 +test_expect_success 'bisect: --no-checkout - target in breakage' '
 +      git bisect reset &&
 +      git bisect start broken BROKEN_HASH4 --no-checkout &&
 +      check_same BROKEN_HASH6 BISECT_HEAD &&
 +      git bisect bad BISECT_HEAD &&
 +      check_same BROKEN_HASH5 BISECT_HEAD &&
 +      git bisect good BISECT_HEAD &&
 +      check_same BROKEN_HASH6 bisect/bad &&
 +      git bisect reset
 +'
 +
 +test_expect_success 'bisect: --no-checkout - target after breakage' '
 +      git bisect reset &&
 +      git bisect start broken BROKEN_HASH4 --no-checkout &&
 +      check_same BROKEN_HASH6 BISECT_HEAD &&
 +      git bisect good BISECT_HEAD &&
 +      check_same BROKEN_HASH8 BISECT_HEAD &&
 +      git bisect good BISECT_HEAD &&
 +      check_same BROKEN_HASH9 bisect/bad &&
 +      git bisect reset
 +'
 +
 +test_expect_success 'bisect: demonstrate identification of damage boundary' "
 +      git bisect reset &&
 +      git checkout broken &&
 +      git bisect start broken master --no-checkout &&
 +      git bisect run \"\$SHELL_PATH\" -c '
 +              GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
 +              git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
 +              git pack-objects --stdout >/dev/null < tmp.\$\$
 +              rc=\$?
 +              rm -f tmp.\$\$
 +              test \$rc = 0' &&
 +      check_same BROKEN_HASH6 bisect/bad &&
 +      git bisect reset
 +"
 +
  test_done