merge: avoid "safer crlf" during recording of merge results
[gitweb.git] / t / t6038-merge-text-auto.sh
index 33b77ee47ae4e35d9da221dddae53182571411eb..5e8d5fa50c9a6a548e5f2fdb11186c165519d06f 100755 (executable)
@@ -91,16 +91,13 @@ test_expect_success 'Merge after setting text=auto' '
        compare_files expected file
 '
 
-test_expect_success 'Merge addition of text=auto' '
+test_expect_success 'Merge addition of text=auto eol=LF' '
+       git config core.eol lf &&
        cat <<-\EOF >expected &&
        first line
        same line
        EOF
 
-       if test_have_prereq NATIVE_CRLF; then
-               append_cr <expected >expected.temp &&
-               mv expected.temp expected
-       fi &&
        git config merge.renormalize true &&
        git rm -fr . &&
        rm -f .gitattributes &&
@@ -109,17 +106,31 @@ test_expect_success 'Merge addition of text=auto' '
        compare_files  expected file
 '
 
+test_expect_success 'Merge addition of text=auto eol=CRLF' '
+       git config core.eol crlf &&
+       cat <<-\EOF >expected &&
+       first line
+       same line
+       EOF
+
+       append_cr <expected >expected.temp &&
+       mv expected.temp expected &&
+       git config merge.renormalize true &&
+       git rm -fr . &&
+       rm -f .gitattributes &&
+       git reset --hard b &&
+       echo >&2 "After git reset --hard b" &&
+       git ls-files -s --eol >&2 &&
+       git merge a &&
+       compare_files  expected file
+'
+
 test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
+       git config core.eol native &&
        echo "<<<<<<<" >expected &&
-       if test_have_prereq NATIVE_CRLF; then
-               echo first line | append_cr >>expected &&
-               echo same line | append_cr >>expected &&
-               echo ======= | append_cr >>expected
-       else
-               echo first line >>expected &&
-               echo same line >>expected &&
-               echo ======= >>expected
-       fi &&
+       echo first line >>expected &&
+       echo same line >>expected &&
+       echo ======= >>expected &&
        echo first line | append_cr >>expected &&
        echo same line | append_cr >>expected &&
        echo ">>>>>>>" >>expected &&
@@ -135,15 +146,9 @@ test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' '
        echo "<<<<<<<" >expected &&
        echo first line | append_cr >>expected &&
        echo same line | append_cr >>expected &&
-       if test_have_prereq NATIVE_CRLF; then
-               echo ======= | append_cr >>expected &&
-               echo first line | append_cr >>expected &&
-               echo same line | append_cr >>expected
-       else
-               echo ======= >>expected &&
-               echo first line >>expected &&
-               echo same line >>expected
-       fi &&
+       echo ======= >>expected &&
+       echo first line >>expected &&
+       echo same line >>expected &&
        echo ">>>>>>>" >>expected &&
        git config merge.renormalize false &&
        rm -f .gitattributes &&