Merge branch 'sg/t0020-conversion-fix'
authorJunio C Hamano <gitster@pobox.com>
Mon, 27 Aug 2018 21:33:46 +0000 (14:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Aug 2018 21:33:47 +0000 (14:33 -0700)
Test fixes.

* sg/t0020-conversion-fix:
t0020-crlf: check the right file

1  2 
t/t0020-crlf.sh
diff --combined t/t0020-crlf.sh
index 5f056982a53b62810192fc8bbb5dbb6d784fb1a2,f7a6a3ce7dc2b18f9fd9c351998992f34ead9518..854da0ae16f8c437c239a0a4e16f1549d87521a2
@@@ -35,7 -35,9 +35,7 @@@ test_expect_success setup 
        for w in Some extra lines here; do echo $w; done >>one &&
        git diff >patch.file &&
        patched=$(git hash-object --stdin <one) &&
 -      git read-tree --reset -u HEAD &&
 -
 -      echo happy.
 +      git read-tree --reset -u HEAD
  '
  
  test_expect_success 'safecrlf: autocrlf=input, all CRLF' '
@@@ -83,11 -85,7 +83,11 @@@ test_expect_success 'safecrlf: print wa
        git add doublewarn &&
        git commit -m "nowarn" &&
        for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn &&
 -      test $(git add doublewarn 2>&1 | grep "CRLF will be replaced by LF" | wc -l) = 1
 +      git add doublewarn 2>err &&
 +      if test_have_prereq C_LOCALE_OUTPUT
 +      then
 +              test $(grep "CRLF will be replaced by LF" err | wc -l) = 1
 +      fi
  '
  
  
@@@ -98,16 -96,6 +98,16 @@@ test_expect_success 'safecrlf: git dif
  '
  
  
 +test_expect_success 'safecrlf: no warning with safecrlf=false' '
 +      git config core.autocrlf input &&
 +      git config core.safecrlf false &&
 +
 +      for w in I am all CRLF; do echo $w; done | append_cr >allcrlf &&
 +      git add allcrlf 2>err &&
 +      test_must_be_empty err
 +'
 +
 +
  test_expect_success 'switch off autocrlf, safecrlf, reset HEAD' '
        git config core.autocrlf false &&
        git config core.safecrlf false &&
@@@ -160,7 -148,7 +160,7 @@@ test_expect_success 'checkout with auto
        git config core.autocrlf input &&
        git read-tree --reset -u HEAD &&
        test_must_fail has_cr one &&
-       test_must_fail has_cr two &&
+       test_must_fail has_cr dir/two &&
        git update-index -- one dir/two &&
        test "$one" = $(git hash-object --stdin <one) &&
        test "$two" = $(git hash-object --stdin <dir/two) &&
@@@ -237,9 -225,29 +237,9 @@@ test_expect_success '.gitattributes say
        git config core.autocrlf true &&
        git read-tree --reset -u HEAD &&
  
 -      if has_cr dir/two
 -      then
 -              echo "Huh?"
 -              false
 -      else
 -              : happy
 -      fi &&
 -
 -      if has_cr one
 -      then
 -              : happy
 -      else
 -              echo "Huh?"
 -              false
 -      fi &&
 -
 -      if has_cr three
 -      then
 -              echo "Huh?"
 -              false
 -      else
 -              : happy
 -      fi
 +      test_must_fail has_cr dir/two &&
 +      verbose has_cr one &&
 +      test_must_fail has_cr three
  '
  
  test_expect_success '.gitattributes says two is input' '
        echo "two crlf=input" >.gitattributes &&
        git read-tree --reset -u HEAD &&
  
 -      if has_cr dir/two
 -      then
 -              echo "Huh?"
 -              false
 -      else
 -              : happy
 -      fi
 +      test_must_fail has_cr dir/two
  '
  
  test_expect_success '.gitattributes says two and three are text' '