Skip to content

Commit

Permalink
MinGW: update tests to handle a native eol of crlf
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brice Lambson authored and Junio C Hamano committed Sep 2, 2014
1 parent 5491e9e commit 5f4e02e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
54 changes: 34 additions & 20 deletions t/t6038-merge-text-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,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 &&
Expand All @@ -86,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 &&
Expand All @@ -95,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 &&
Expand All @@ -114,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 &&
Expand Down
1 change: 1 addition & 0 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@ case $(uname -s) in
# exec does not inherit the PID
test_set_prereq MINGW
test_set_prereq NOT_CYGWIN
test_set_prereq NATIVE_CRLF
test_set_prereq SED_STRIPS_CR
test_set_prereq GREP_STRIPS_CR
GIT_TEST_CMP=mingw_test_cmp
Expand Down

0 comments on commit 5f4e02e

Please sign in to comment.