Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 14b4175

Browse files
Brice Lambsonkblees
authored andcommitted
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 <[email protected]>
1 parent d98aa9f commit 14b4175

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

t/t6038-merge-text-auto.sh

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ test_expect_success 'Merge after setting text=auto' '
7272
same line
7373
EOF
7474
75+
if test_have_prereq NATIVE_CRLF; then
76+
append_cr <expected >expected.temp &&
77+
mv expected.temp expected
78+
fi &&
7579
git config merge.renormalize true &&
7680
git rm -fr . &&
7781
rm -f .gitattributes &&
@@ -86,6 +90,10 @@ test_expect_success 'Merge addition of text=auto' '
8690
same line
8791
EOF
8892
93+
if test_have_prereq NATIVE_CRLF; then
94+
append_cr <expected >expected.temp &&
95+
mv expected.temp expected
96+
fi &&
8997
git config merge.renormalize true &&
9098
git rm -fr . &&
9199
rm -f .gitattributes &&
@@ -95,16 +103,19 @@ test_expect_success 'Merge addition of text=auto' '
95103
'
96104

97105
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 &&
108119
git config merge.renormalize false &&
109120
rm -f .gitattributes &&
110121
git reset --hard a &&
@@ -114,16 +125,19 @@ test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
114125
'
115126

116127
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 &&
127141
git config merge.renormalize false &&
128142
rm -f .gitattributes &&
129143
git reset --hard b &&

t/test-lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ case $(uname -s) in
871871
# exec does not inherit the PID
872872
test_set_prereq MINGW
873873
test_set_prereq NOT_CYGWIN
874+
test_set_prereq NATIVE_CRLF
874875
test_set_prereq SED_STRIPS_CR
875876
test_set_prereq GREP_STRIPS_CR
876877
GIT_TEST_CMP=mingw_test_cmp

0 commit comments

Comments
 (0)