MinGW: update tests to handle a native eol of crlf

Some of the tests were written with the assumption that the native eol would always be lf. After defining NATIVE_CRLF on MinGW, these tests began failing. This change will update the tests to also handle a native eol of crlf. Signed-off-by: Brice Lambson <bricelam@live.com> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brice Lambson committed Aug 30, 2014 at 23:39 UTC 5f4e02e5173c64b5b760f35283c4b0094bb85881
2 files changed +35 -20
t/t6038-merge-text-auto.sh
+34 -20
@@ -72,6 +72,10 @@ test_expect_success 'Merge after setting text=auto' '
72 same line
73 EOF
74
75 + if test_have_prereq NATIVE_CRLF; then
76 + append_cr <expected >expected.temp &&
77 + mv expected.temp expected
78 + fi &&
79 git config merge.renormalize true &&
80 git rm -fr . &&
81 rm -f .gitattributes &&
@@ -86,6 +90,10 @@ test_expect_success 'Merge addition of text=auto' '
90 same line
91 EOF
92
93 + if test_have_prereq NATIVE_CRLF; then
94 + append_cr <expected >expected.temp &&
95 + mv expected.temp expected
96 + fi &&
97 git config merge.renormalize true &&
98 git rm -fr . &&
99 rm -f .gitattributes &&
@@ -95,16 +103,19 @@ test_expect_success 'Merge addition of text=auto' '
103 '
104
105 test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
98 - q_to_cr <<-\EOF >expected &&
99 - <<<<<<<
100 - first line
101 - same line
102 - =======
103 - first lineQ
104 - same lineQ
105 - >>>>>>>
106 - EOF
107 -
106 + echo "<<<<<<<" >expected &&
107 + if test_have_prereq NATIVE_CRLF; then
108 + echo first line | append_cr >>expected &&
109 + echo same line | append_cr >>expected &&
110 + echo ======= | append_cr >>expected
111 + else
112 + echo first line >>expected &&
113 + echo same line >>expected &&
114 + echo ======= >>expected
115 + fi &&
116 + echo first line | append_cr >>expected &&
117 + echo same line | append_cr >>expected &&
118 + echo ">>>>>>>" >>expected &&
119 git config merge.renormalize false &&
120 rm -f .gitattributes &&
121 git reset --hard a &&
@@ -114,16 +125,19 @@ test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
125 '
126
127 test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' '
117 - q_to_cr <<-\EOF >expected &&
118 - <<<<<<<
119 - first lineQ
120 - same lineQ
121 - =======
122 - first line
123 - same line
124 - >>>>>>>
125 - EOF
126 -
128 + echo "<<<<<<<" >expected &&
129 + echo first line | append_cr >>expected &&
130 + echo same line | append_cr >>expected &&
131 + if test_have_prereq NATIVE_CRLF; then
132 + echo ======= | append_cr >>expected &&
133 + echo first line | append_cr >>expected &&
134 + echo same line | append_cr >>expected
135 + else
136 + echo ======= >>expected &&
137 + echo first line >>expected &&
138 + echo same line >>expected
139 + fi &&
140 + echo ">>>>>>>" >>expected &&
141 git config merge.renormalize false &&
142 rm -f .gitattributes &&
143 git reset --hard b &&
t/test-lib.sh
+1
@@ -867,6 +867,7 @@ case $(uname -s) in
867 # exec does not inherit the PID
868 test_set_prereq MINGW
869 test_set_prereq NOT_CYGWIN
870 + test_set_prereq NATIVE_CRLF
871 test_set_prereq SED_STRIPS_CR
872 test_set_prereq GREP_STRIPS_CR
873 GIT_TEST_CMP=mingw_test_cmp