# [PATCH v3 2/2] MinGW: Update tests to handle a native eol of crlf

5 messages from 2014-08-30 to 2014-09-03. Participants: Torsten Bögershausen, Junio C Hamano.
Thread: https://gitlist.dev/t/37462

## Torsten Bögershausen, 2014-08-30 21:39

Subject: [PATCH v3 2/2] MinGW: Update tests to handle a native eol of crlf
Message-ID: <5402447B.3080700@web.de>
URL: https://gitlist.dev/e/5402447B.3080700%40web.de

```
Integrate commit b1d07649588102 from msysgit:
  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>

On top of that, fix the broken && chain in t0026

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 t/t0026-eol-config.sh      |  6 +++---
 t/t6038-merge-text-auto.sh | 54 +++++++++++++++++++++++++++++-----------------
 t/test-lib.sh              |  1 +
 3 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/t/t0026-eol-config.sh b/t/t0026-eol-config.sh
index 43a580a..4806969 100755
--- a/t/t0026-eol-config.sh
+++ b/t/t0026-eol-config.sh
@@ -84,9 +84,9 @@ test_expect_success NATIVE_CRLF 'eol native is crlf' '
 
 	rm -rf native_eol && mkdir native_eol &&
 	( cd native_eol &&
-	printf "*.txt text\n" > .gitattributes
-	printf "one\r\ntwo\r\nthree\r\n" > filedos.txt
-	printf "one\ntwo\nthree\n" > fileunix.txt
+	printf "*.txt text\n" > .gitattributes &&
+	printf "one\r\ntwo\r\nthree\r\n" > filedos.txt &&
+	printf "one\ntwo\nthree\n" > fileunix.txt &&
 	git init &&
 	git config core.autocrlf false &&
 	git config core.eol native &&
diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh
index d9c2d38..85c10b0 100755
--- a/t/t6038-merge-text-auto.sh
+++ b/t/t6038-merge-text-auto.sh
@@ -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 &&
@@ -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 &&
@@ -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 &&
@@ -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 &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index b1bc65b..aceb418 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -871,6 +871,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
-- 
2.1.0.rc2.210.g636bceb

```

## Junio C Hamano, 2014-09-02 19:10

Subject: Re: [PATCH v3 2/2] MinGW: Update tests to handle a native eol of crlf
Message-ID: <xmqq1trt25zt.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqq1trt25zt.fsf%40gitster.dls.corp.google.com
In-Reply-To: <5402447B.3080700@web.de>

```
Torsten Bögershausen <tboegi@web.de> writes:

> Integrate commit b1d07649588102 from msysgit:
>   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>
>
> On top of that, fix the broken && chain in t0026
>
> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---

Should this be marked with "From: Brice Lambson <bricelam@live.com>"?

Thanks.

```

## Torsten Bögershausen, 2014-09-02 19:53

Subject: Re: [PATCH v3 2/2] MinGW: Update tests to handle a native eol of crlf
Message-ID: <54062052.3070106@web.de>
URL: https://gitlist.dev/e/54062052.3070106%40web.de
In-Reply-To: <xmqq1trt25zt.fsf@gitster.dls.corp.google.com>

```
On 2014-09-02 21.10, Junio C Hamano wrote:
> Torsten Bögershausen <tboegi@web.de> writes:
> 
>> Integrate commit b1d07649588102 from msysgit:
>>   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>
>>
>> On top of that, fix the broken && chain in t0026
>>
>> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
>> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
>> ---
> 
> Should this be marked with "From: Brice Lambson <bricelam@live.com>"?
> 
> Thanks.
Yes. If possible please squeeze.

```

## Junio C Hamano, 2014-09-02 20:49

Subject: Re: [PATCH v3 2/2] MinGW: Update tests to handle a native eol of crlf
Message-ID: <xmqqk35lzr0u.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqk35lzr0u.fsf%40gitster.dls.corp.google.com
In-Reply-To: <54062052.3070106@web.de>

```
Torsten Bögershausen <tboegi@web.de> writes:

>> Should this be marked with "From: Brice Lambson <bricelam@live.com>"?
>> 
>> Thanks.
> Yes. If possible please squeeze.

OK, thanks.  Please double check the result on 'pu' in several
hours.

```

## Torsten Bögershausen, 2014-09-03 18:19

Subject: Re: [PATCH v3 2/2] MinGW: Update tests to handle a native eol of crlf
Message-ID: <54075BA7.2090101@web.de>
URL: https://gitlist.dev/e/54075BA7.2090101%40web.de
In-Reply-To: <xmqqk35lzr0u.fsf@gitster.dls.corp.google.com>

```
On 2014-09-02 22.49, Junio C Hamano wrote:
> Torsten Bögershausen <tboegi@web.de> writes:
> 
>>> Should this be marked with "From: Brice Lambson <bricelam@live.com>"?
>>>
>>> Thanks.
>> Yes. If possible please squeeze.
> 
> OK, thanks.  Please double check the result on 'pu' in several
> hours.
Excellent

t0027 and t0026 passed under Cygwin, MysGit and Mac OS.
(after reverting "use timer_settime() for new platforms", but that is a different story)

Many thanks for helping me out and bringing this forward.

```
