Merge branch 'jc/parseopt-verify-short-name'
[gitweb.git] / t / t6038-merge-text-auto.sh
index 52d0dc4bb8f80393c79935f9c951b5323287e41c..85c10b0940a896bb49aefee9a2885b1c39217bab 100755 (executable)
@@ -14,6 +14,8 @@ test_description='CRLF merge conflict across text=auto change
 
 . ./test-lib.sh
 
+test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
+
 test_expect_success setup '
        git config core.autocrlf false &&
 
@@ -60,7 +62,7 @@ test_expect_success setup '
 
 test_expect_success 'set up fuzz_conflict() helper' '
        fuzz_conflict() {
-               sed -e "s/^\([<>=]......\) .*/\1/" "$@"
+               sed $SED_OPTIONS -e "s/^\([<>=]......\) .*/\1/" "$@"
        }
 '
 
@@ -70,6 +72,10 @@ test_expect_success 'Merge after setting text=auto' '
        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 &&
@@ -84,6 +90,10 @@ test_expect_success 'Merge addition of text=auto' '
        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 &&
@@ -93,16 +103,19 @@ test_expect_success 'Merge addition of text=auto' '
 '
 
 test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
-       q_to_cr <<-\EOF >expected &&
-       <<<<<<<
-       first line
-       same line
-       =======
-       first lineQ
-       same lineQ
-       >>>>>>>
-       EOF
-
+       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 | append_cr >>expected &&
+       echo same line | append_cr >>expected &&
+       echo ">>>>>>>" >>expected &&
        git config merge.renormalize false &&
        rm -f .gitattributes &&
        git reset --hard a &&
@@ -112,16 +125,19 @@ test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
 '
 
 test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' '
-       q_to_cr <<-\EOF >expected &&
-       <<<<<<<
-       first lineQ
-       same lineQ
-       =======
-       first line
-       same line
-       >>>>>>>
-       EOF
-
+       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 &&
        git config merge.renormalize false &&
        rm -f .gitattributes &&
        git reset --hard b &&