git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* t3032 incompatible with Cygwin/Windows
@ 2013-07-16 18:33 Mark Levedahl
  2013-07-16 18:49 ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Mark Levedahl
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Mark Levedahl @ 2013-07-16 18:33 UTC (permalink / raw)
  To: Git Mailing List

Subtests 6,7, and 9 of t3032 fail on Cygwin, and I presume will fail on 
msysgit for similar reasons. Looking at test 6, the expected result is a 
line ending with \r\n in text.txt. This line is extracted with grep 
(grep 'justice and holiness' text.txt > actual), with unavoidable result 
that on Cygwin the line ending is \n. This happens because on Cygwin, 
the text utils are compiled to open files in text mode meaning than \n 
and \r\n are both recognized as EOL markers. Thus, even though text.txt 
is an exact match for what is created on Linux, the test fails because 
\r\n cannot be distinguished by the available tools.

I'm not sure the right way forward. I did confirm that by substituting 
"q_to_tab" for "q_to_cr" in t3032, the test pass on Cygwin and on Linux. 
Perhaps t3032 should be so amended to avoid use of a non-portable line 
ending construct?

Mark

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] t3032 - make compatible with systems using \r\n as a line ending
  2013-07-16 18:33 t3032 incompatible with Cygwin/Windows Mark Levedahl
@ 2013-07-16 18:49 ` Mark Levedahl
  2013-07-16 18:59   ` Jonathan Nieder
  2013-07-16 18:56 ` t3032 incompatible with Cygwin/Windows Jonathan Nieder
  2013-07-18 19:11 ` Ramsay Jones
  2 siblings, 1 reply; 14+ messages in thread
From: Mark Levedahl @ 2013-07-16 18:49 UTC (permalink / raw)
  To: git; +Cc: Mark Levedahl

Subtests 6, 7, and 9 rely test that merge-recursive correctly
ignores whitespace when so directed. Change the particular whitespace
sequences to be ones that are not known line endings so the whitespace
is not changed when being extracted by line oriented grep.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 t/t3032-merge-recursive-options.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
index 2b17311..52e275c 100755
--- a/t/t3032-merge-recursive-options.sh
+++ b/t/t3032-merge-recursive-options.sh
@@ -92,7 +92,7 @@ test_expect_success 'setup' '
 			s/Polemarchus interposing./Polemarchus, interposing.Q/
 			/justice and holiness/ s/$/Q/
 			/pay your debts/ s/$/Q/
-		" text.txt | q_to_cr >text.txt+ &&
+		" text.txt | q_to_tab >text.txt+ &&
 	mv text.txt+ text.txt &&
 	git commit -a -m "Clarify" &&
 	git show-branch --all
@@ -125,7 +125,7 @@ test_expect_success '-Xignore-space-change makes cherry-pick succeed' '
 '
 
 test_expect_success '--ignore-space-change: our w/s-only change wins' '
-	q_to_cr <<-\EOF >expected &&
+	q_to_tab <<-\EOF >expected &&
 	    justice and holiness and is the nurse of his age and theQ
 	EOF
 
@@ -150,7 +150,7 @@ test_expect_success '--ignore-space-change: does not ignore new spaces' '
 	cat <<-\EOF >expected1 &&
 	Well said, Cephalus, I replied; but as con cerning justice, what is
 	EOF
-	q_to_cr <<-\EOF >expected2 &&
+	q_to_tab <<-\EOF >expected2 &&
 	un intentionally; and when he departs to the world below he is not inQ
 	EOF
 
@@ -174,7 +174,7 @@ test_expect_success '--ignore-all-space drops their new spaces' '
 '
 
 test_expect_success '--ignore-all-space keeps our new spaces' '
-	q_to_cr <<-\EOF >expected &&
+	q_to_tab <<-\EOF >expected &&
 	un intentionally; and when he departs to the world below he is not inQ
 	EOF
 
@@ -185,7 +185,7 @@ test_expect_success '--ignore-all-space keeps our new spaces' '
 '
 
 test_expect_success '--ignore-space-at-eol' '
-	q_to_cr <<-\EOF >expected &&
+	q_to_tab <<-\EOF >expected &&
 	<<<<<<< HEAD
 	is not in his right mind; ought I to give them back to him?  No oneQ
 	=======
-- 
1.8.3.2.0.13

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: t3032 incompatible with Cygwin/Windows
  2013-07-16 18:33 t3032 incompatible with Cygwin/Windows Mark Levedahl
  2013-07-16 18:49 ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Mark Levedahl
@ 2013-07-16 18:56 ` Jonathan Nieder
  2013-07-18 19:11 ` Ramsay Jones
  2 siblings, 0 replies; 14+ messages in thread
From: Jonathan Nieder @ 2013-07-16 18:56 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: Git Mailing List

Mark Levedahl wrote:

> Subtests 6,7, and 9 of t3032 fail on Cygwin, and I presume will fail
> on msysgit for similar reasons. Looking at test 6, the expected
> result is a line ending with \r\n in text.txt. This line is
> extracted with grep (grep 'justice and holiness' text.txt > actual),
> with unavoidable result that on Cygwin the line ending is \n.

Would using perl instead of grep fix this?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] t3032 - make compatible with systems using \r\n as a line ending
  2013-07-16 18:49 ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Mark Levedahl
@ 2013-07-16 18:59   ` Jonathan Nieder
  2013-07-16 19:44     ` Mark Levedahl
                       ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Jonathan Nieder @ 2013-07-16 18:59 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: git

Mark Levedahl wrote:

> Subtests 6, 7, and 9 rely test that merge-recursive correctly
> ignores whitespace when so directed. Change the particular whitespace
> sequences to be ones that are not known line endings so the whitespace
> is not changed when being extracted by line oriented grep.

merge-recursive needs to be able to deal with \r at EOL, too, so if at
all possible I would prefer to see the test fixed to pass on Cygwin
some other way.

Thanks.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] t3032 - make compatible with systems using \r\n as a line ending
  2013-07-16 18:59   ` Jonathan Nieder
@ 2013-07-16 19:44     ` Mark Levedahl
  2013-07-16 20:26     ` Mark Levedahl
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Mark Levedahl @ 2013-07-16 19:44 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

On 07/16/2013 02:59 PM, Jonathan Nieder wrote:
> Mark Levedahl wrote:
>
>> Subtests 6, 7, and 9 rely test that merge-recursive correctly
>> ignores whitespace when so directed. Change the particular whitespace
>> sequences to be ones that are not known line endings so the whitespace
>> is not changed when being extracted by line oriented grep.
> merge-recursive needs to be able to deal with \r at EOL, too, so if at
> all possible I would prefer to see the test fixed to pass on Cygwin
> some other way.
>
> Thanks.
>
No line oriented tool is going to avoid this problem. I suppose someone 
with much more perl skill I possess could write a grep replacement 
explicitly using binary file modes to fix this. Or, the test could just 
check the sha1sum of text.txt against a prestored value, Or the test 
could use \r\n ONLY on systems that do not use that as a line ending 
mode. Or ...

Mark

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] t3032 - make compatible with systems using \r\n as a line ending
  2013-07-16 18:59   ` Jonathan Nieder
  2013-07-16 19:44     ` Mark Levedahl
@ 2013-07-16 20:26     ` Mark Levedahl
  2013-07-16 20:32     ` Mark Levedahl
  2013-07-18 19:19     ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Ramsay Jones
  3 siblings, 0 replies; 14+ messages in thread
From: Mark Levedahl @ 2013-07-16 20:26 UTC (permalink / raw)
  To: git; +Cc: Mark Levedahl

Subtests 6, 7, and 9 rely test that merge-recursive correctly
ignores whitespace when so directed. These tests create and test for
lines ending in \r\n, but as this is a valid line separator on Windows,
convert such lines in the output to avoid confusion by line-oriented
grep.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 t/t3032-merge-recursive-options.sh | 22 +++++++++++++---------
 t/test-lib-functions.sh            |  4 ++++
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
index 2b17311..41ba184 100755
--- a/t/t3032-merge-recursive-options.sh
+++ b/t/t3032-merge-recursive-options.sh
@@ -125,13 +125,14 @@ test_expect_success '-Xignore-space-change makes cherry-pick succeed' '
 '
 
 test_expect_success '--ignore-space-change: our w/s-only change wins' '
-	q_to_cr <<-\EOF >expected &&
+	cat <<-\EOF >expected &&
 	    justice and holiness and is the nurse of his age and theQ
 	EOF
 
 	git read-tree --reset -u HEAD &&
 	git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
-	grep "justice and holiness" text.txt >actual &&
+	cr_to_q <text.txt > text.txt+ &&
+	grep "justice and holiness" text.txt+ >actual &&
 	test_cmp expected actual
 '
 
@@ -150,14 +151,15 @@ test_expect_success '--ignore-space-change: does not ignore new spaces' '
 	cat <<-\EOF >expected1 &&
 	Well said, Cephalus, I replied; but as con cerning justice, what is
 	EOF
-	q_to_cr <<-\EOF >expected2 &&
+	cat <<-\EOF >expected2 &&
 	un intentionally; and when he departs to the world below he is not inQ
 	EOF
 
 	git read-tree --reset -u HEAD &&
 	git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
-	grep "Well said" text.txt >actual1 &&
-	grep "when he departs" text.txt >actual2 &&
+	cr_to_q <text.txt >text.txt+
+	grep "Well said" text.txt+ >actual1 &&
+	grep "when he departs" text.txt+ >actual2 &&
 	test_cmp expected1 actual1 &&
 	test_cmp expected2 actual2
 '
@@ -174,18 +176,19 @@ test_expect_success '--ignore-all-space drops their new spaces' '
 '
 
 test_expect_success '--ignore-all-space keeps our new spaces' '
-	q_to_cr <<-\EOF >expected &&
+	cat <<-\EOF >expected &&
 	un intentionally; and when he departs to the world below he is not inQ
 	EOF
 
 	git read-tree --reset -u HEAD &&
 	git merge-recursive --ignore-all-space HEAD^ -- HEAD remote &&
-	grep "when he departs" text.txt >actual &&
+	cr_to_q <text.txt >text.txt+ &&
+	grep "when he departs" text.txt+ >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success '--ignore-space-at-eol' '
-	q_to_cr <<-\EOF >expected &&
+	cat <<-\EOF >expected &&
 	<<<<<<< HEAD
 	is not in his right mind; ought I to give them back to him?  No oneQ
 	=======
@@ -196,7 +199,8 @@ test_expect_success '--ignore-space-at-eol' '
 	git read-tree --reset -u HEAD &&
 	test_must_fail git merge-recursive --ignore-space-at-eol \
 						 HEAD^ -- HEAD remote &&
-	conflict_hunks text.txt >actual &&
+	cr_to_q <text.txt >text.txt+ &&
+	conflict_hunks text.txt+ >actual &&
 	test_cmp expected actual
 '
 
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index a7e9aac..aa8e38f 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -87,6 +87,10 @@ q_to_cr () {
 	tr Q '\015'
 }
 
+cr_to_q () {
+	tr '\015' Q
+}
+
 q_to_tab () {
 	tr Q '\011'
 }
-- 
1.8.3.2.0.13

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH] t3032 - make compatible with systems using \r\n as a line ending
  2013-07-16 18:59   ` Jonathan Nieder
  2013-07-16 19:44     ` Mark Levedahl
  2013-07-16 20:26     ` Mark Levedahl
@ 2013-07-16 20:32     ` Mark Levedahl
  2013-07-17 19:33       ` Junio C Hamano
  2013-07-18 19:19     ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Ramsay Jones
  3 siblings, 1 reply; 14+ messages in thread
From: Mark Levedahl @ 2013-07-16 20:32 UTC (permalink / raw)
  To: git, jrnieder; +Cc: Mark Levedahl

Subtests 6, 7, and 9 rely test that merge-recursive correctly
ignores whitespace when so directed. These tests create and test for
lines ending in \r\n, but as this is a valid line separator on Windows,
convert such lines in the output to avoid confusion by line-oriented
grep.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
Sorry, forgot to copy Jonathan...

 t/t3032-merge-recursive-options.sh | 22 +++++++++++++---------
 t/test-lib-functions.sh            |  4 ++++
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
index 2b17311..41ba184 100755
--- a/t/t3032-merge-recursive-options.sh
+++ b/t/t3032-merge-recursive-options.sh
@@ -125,13 +125,14 @@ test_expect_success '-Xignore-space-change makes cherry-pick succeed' '
 '
 
 test_expect_success '--ignore-space-change: our w/s-only change wins' '
-	q_to_cr <<-\EOF >expected &&
+	cat <<-\EOF >expected &&
 	    justice and holiness and is the nurse of his age and theQ
 	EOF
 
 	git read-tree --reset -u HEAD &&
 	git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
-	grep "justice and holiness" text.txt >actual &&
+	cr_to_q <text.txt > text.txt+ &&
+	grep "justice and holiness" text.txt+ >actual &&
 	test_cmp expected actual
 '
 
@@ -150,14 +151,15 @@ test_expect_success '--ignore-space-change: does not ignore new spaces' '
 	cat <<-\EOF >expected1 &&
 	Well said, Cephalus, I replied; but as con cerning justice, what is
 	EOF
-	q_to_cr <<-\EOF >expected2 &&
+	cat <<-\EOF >expected2 &&
 	un intentionally; and when he departs to the world below he is not inQ
 	EOF
 
 	git read-tree --reset -u HEAD &&
 	git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
-	grep "Well said" text.txt >actual1 &&
-	grep "when he departs" text.txt >actual2 &&
+	cr_to_q <text.txt >text.txt+
+	grep "Well said" text.txt+ >actual1 &&
+	grep "when he departs" text.txt+ >actual2 &&
 	test_cmp expected1 actual1 &&
 	test_cmp expected2 actual2
 '
@@ -174,18 +176,19 @@ test_expect_success '--ignore-all-space drops their new spaces' '
 '
 
 test_expect_success '--ignore-all-space keeps our new spaces' '
-	q_to_cr <<-\EOF >expected &&
+	cat <<-\EOF >expected &&
 	un intentionally; and when he departs to the world below he is not inQ
 	EOF
 
 	git read-tree --reset -u HEAD &&
 	git merge-recursive --ignore-all-space HEAD^ -- HEAD remote &&
-	grep "when he departs" text.txt >actual &&
+	cr_to_q <text.txt >text.txt+ &&
+	grep "when he departs" text.txt+ >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success '--ignore-space-at-eol' '
-	q_to_cr <<-\EOF >expected &&
+	cat <<-\EOF >expected &&
 	<<<<<<< HEAD
 	is not in his right mind; ought I to give them back to him?  No oneQ
 	=======
@@ -196,7 +199,8 @@ test_expect_success '--ignore-space-at-eol' '
 	git read-tree --reset -u HEAD &&
 	test_must_fail git merge-recursive --ignore-space-at-eol \
 						 HEAD^ -- HEAD remote &&
-	conflict_hunks text.txt >actual &&
+	cr_to_q <text.txt >text.txt+ &&
+	conflict_hunks text.txt+ >actual &&
 	test_cmp expected actual
 '
 
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index a7e9aac..aa8e38f 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -87,6 +87,10 @@ q_to_cr () {
 	tr Q '\015'
 }
 
+cr_to_q () {
+	tr '\015' Q
+}
+
 q_to_tab () {
 	tr Q '\011'
 }
-- 
1.8.3.2.0.13

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] t3032 - make compatible with systems using \r\n as a line ending
  2013-07-16 20:32     ` Mark Levedahl
@ 2013-07-17 19:33       ` Junio C Hamano
  2013-07-18 21:44         ` [PATCH] test-lib.sh - define and use GREP_STRIPS_CR Mark Levedahl
  0 siblings, 1 reply; 14+ messages in thread
From: Junio C Hamano @ 2013-07-17 19:33 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: git, jrnieder

Mark Levedahl <mlevedahl@gmail.com> writes:

> Subtests 6, 7, and 9 rely test that merge-recursive correctly
> ignores whitespace when so directed. These tests create and test for
> lines ending in \r\n, but as this is a valid line separator on Windows,
> convert such lines in the output to avoid confusion by line-oriented
> grep.
>
> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
> ---
> Sorry, forgot to copy Jonathan...

Sounds sensible.  Thanks.

>
>  t/t3032-merge-recursive-options.sh | 22 +++++++++++++---------
>  t/test-lib-functions.sh            |  4 ++++
>  2 files changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
> index 2b17311..41ba184 100755
> --- a/t/t3032-merge-recursive-options.sh
> +++ b/t/t3032-merge-recursive-options.sh
> @@ -125,13 +125,14 @@ test_expect_success '-Xignore-space-change makes cherry-pick succeed' '
>  '
>  
>  test_expect_success '--ignore-space-change: our w/s-only change wins' '
> -	q_to_cr <<-\EOF >expected &&
> +	cat <<-\EOF >expected &&
>  	    justice and holiness and is the nurse of his age and theQ
>  	EOF
>  
>  	git read-tree --reset -u HEAD &&
>  	git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
> -	grep "justice and holiness" text.txt >actual &&
> +	cr_to_q <text.txt > text.txt+ &&
> +	grep "justice and holiness" text.txt+ >actual &&
>  	test_cmp expected actual
>  '
>  
> @@ -150,14 +151,15 @@ test_expect_success '--ignore-space-change: does not ignore new spaces' '
>  	cat <<-\EOF >expected1 &&
>  	Well said, Cephalus, I replied; but as con cerning justice, what is
>  	EOF
> -	q_to_cr <<-\EOF >expected2 &&
> +	cat <<-\EOF >expected2 &&
>  	un intentionally; and when he departs to the world below he is not inQ
>  	EOF
>  
>  	git read-tree --reset -u HEAD &&
>  	git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
> -	grep "Well said" text.txt >actual1 &&
> -	grep "when he departs" text.txt >actual2 &&
> +	cr_to_q <text.txt >text.txt+
> +	grep "Well said" text.txt+ >actual1 &&
> +	grep "when he departs" text.txt+ >actual2 &&
>  	test_cmp expected1 actual1 &&
>  	test_cmp expected2 actual2
>  '
> @@ -174,18 +176,19 @@ test_expect_success '--ignore-all-space drops their new spaces' '
>  '
>  
>  test_expect_success '--ignore-all-space keeps our new spaces' '
> -	q_to_cr <<-\EOF >expected &&
> +	cat <<-\EOF >expected &&
>  	un intentionally; and when he departs to the world below he is not inQ
>  	EOF
>  
>  	git read-tree --reset -u HEAD &&
>  	git merge-recursive --ignore-all-space HEAD^ -- HEAD remote &&
> -	grep "when he departs" text.txt >actual &&
> +	cr_to_q <text.txt >text.txt+ &&
> +	grep "when he departs" text.txt+ >actual &&
>  	test_cmp expected actual
>  '
>  
>  test_expect_success '--ignore-space-at-eol' '
> -	q_to_cr <<-\EOF >expected &&
> +	cat <<-\EOF >expected &&
>  	<<<<<<< HEAD
>  	is not in his right mind; ought I to give them back to him?  No oneQ
>  	=======
> @@ -196,7 +199,8 @@ test_expect_success '--ignore-space-at-eol' '
>  	git read-tree --reset -u HEAD &&
>  	test_must_fail git merge-recursive --ignore-space-at-eol \
>  						 HEAD^ -- HEAD remote &&
> -	conflict_hunks text.txt >actual &&
> +	cr_to_q <text.txt >text.txt+ &&
> +	conflict_hunks text.txt+ >actual &&
>  	test_cmp expected actual
>  '
>  
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> index a7e9aac..aa8e38f 100644
> --- a/t/test-lib-functions.sh
> +++ b/t/test-lib-functions.sh
> @@ -87,6 +87,10 @@ q_to_cr () {
>  	tr Q '\015'
>  }
>  
> +cr_to_q () {
> +	tr '\015' Q
> +}
> +
>  q_to_tab () {
>  	tr Q '\011'
>  }

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: t3032 incompatible with Cygwin/Windows
  2013-07-16 18:33 t3032 incompatible with Cygwin/Windows Mark Levedahl
  2013-07-16 18:49 ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Mark Levedahl
  2013-07-16 18:56 ` t3032 incompatible with Cygwin/Windows Jonathan Nieder
@ 2013-07-18 19:11 ` Ramsay Jones
  2 siblings, 0 replies; 14+ messages in thread
From: Ramsay Jones @ 2013-07-18 19:11 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: Git Mailing List

Mark Levedahl wrote:
> Subtests 6,7, and 9 of t3032 fail on Cygwin, and I presume will fail on 
> msysgit for similar reasons. Looking at test 6, the expected result is a 
> line ending with \r\n in text.txt. This line is extracted with grep 
> (grep 'justice and holiness' text.txt > actual), with unavoidable result 
> that on Cygwin the line ending is \n. This happens because on Cygwin, 
> the text utils are compiled to open files in text mode meaning than \n 
> and \r\n are both recognized as EOL markers. Thus, even though text.txt 
> is an exact match for what is created on Linux, the test fails because 
> \r\n cannot be distinguished by the available tools.
> 
> I'm not sure the right way forward. I did confirm that by substituting 
> "q_to_tab" for "q_to_cr" in t3032, the test pass on Cygwin and on Linux. 
> Perhaps t3032 should be so amended to avoid use of a non-portable line 
> ending construct?

This passes for me, on both cygwin and MinGW.

After adding a test_pause to test #6:

$ ./t3032-merge-recursive-options.sh -v

...

expecting success:
        q_to_cr <<-\EOF >expected &&
            justice and holiness and is the nurse of his age and theQ
        EOF

        git read-tree --reset -u HEAD &&
        git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
        grep "justice and holiness" text.txt >actual &&
        test_cmp expected actual &&
        test_pause

Merging HEAD with remote
Merging:
0ab7224 Clarify
be82dcf Remove cruft
found 1 common ancestor:
c1e95d9 Initial revision
Auto-merging text.txt
$ xxd expected
0000000: 2020 2020 6a75 7374 6963 6520 616e 6420      justice and
0000010: 686f 6c69 6e65 7373 2061 6e64 2069 7320  holiness and is
0000020: 7468 6520 6e75 7273 6520 6f66 2068 6973  the nurse of his
0000030: 2061 6765 2061 6e64 2074 6865 0d0a        age and the..
$ xxd actual
0000000: 2020 2020 6a75 7374 6963 6520 616e 6420      justice and
0000010: 686f 6c69 6e65 7373 2061 6e64 2069 7320  holiness and is
0000020: 7468 6520 6e75 7273 6520 6f66 2068 6973  the nurse of his
0000030: 2061 6765 2061 6e64 2074 6865 0d0a        age and the..
$ grep "justice and holiness" text.txt | xxd
0000000: 2020 2020 6a75 7374 6963 6520 616e 6420      justice and
0000010: 686f 6c69 6e65 7373 2061 6e64 2069 7320  holiness and is
0000020: 7468 6520 6e75 7273 6520 6f66 2068 6973  the nurse of his
0000030: 2061 6765 2061 6e64 2074 6865 0d0a        age and the..
$ exit

...

# passed all 11 test(s)
1..11
$ 

ATB,
Ramsay Jones

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] t3032 - make compatible with systems using \r\n as a line ending
  2013-07-16 18:59   ` Jonathan Nieder
                       ` (2 preceding siblings ...)
  2013-07-16 20:32     ` Mark Levedahl
@ 2013-07-18 19:19     ` Ramsay Jones
  2013-07-18 21:47       ` Mark Levedahl
  3 siblings, 1 reply; 14+ messages in thread
From: Ramsay Jones @ 2013-07-18 19:19 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Mark Levedahl, git

Jonathan Nieder wrote:
> Mark Levedahl wrote:
> 
>> Subtests 6, 7, and 9 rely test that merge-recursive correctly
>> ignores whitespace when so directed. Change the particular whitespace
>> sequences to be ones that are not known line endings so the whitespace
>> is not changed when being extracted by line oriented grep.
> 
> merge-recursive needs to be able to deal with \r at EOL, too, so if at
> all possible I would prefer to see the test fixed to pass on Cygwin
> some other way.

Maybe use -U/--binary option to grep? Indeed, if you look at the top of
that test file, you will see:

    test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
    test_have_prereq MINGW && export GREP_OPTIONS=-U

which may explain why it works for me on MinGW, but not why it works on
cygwin 1.5.

ATB,
Ramsay Jones

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] test-lib.sh - define and use GREP_STRIPS_CR
  2013-07-17 19:33       ` Junio C Hamano
@ 2013-07-18 21:44         ` Mark Levedahl
  2013-07-20 19:41           ` Ramsay Jones
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Levedahl @ 2013-07-18 21:44 UTC (permalink / raw)
  To: gitster, ramsay, jrnieder; +Cc: git, Mark Levedahl

Define a common macro for grep needing -U to allow tests to not need
to inquire of specific platforms needing this option. Change
t3032 and t5560 to use this rather than testing explicitly for mingw.
This fixes these two tests on Cygwin.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
This replaces my earlier patch against t3032 (8896b287 on pu)

 t/t3032-merge-recursive-options.sh | 2 +-
 t/t5560-http-backend-noserver.sh   | 2 +-
 t/test-lib.sh                      | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
index 2b17311..5fd7bbb 100755
--- a/t/t3032-merge-recursive-options.sh
+++ b/t/t3032-merge-recursive-options.sh
@@ -14,7 +14,7 @@ test_description='merge-recursive options
 . ./test-lib.sh
 
 test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
-test_have_prereq MINGW && export GREP_OPTIONS=-U
+test_have_prereq GREP_STRIPS_CR && export GREP_OPTIONS=-U
 
 test_expect_success 'setup' '
 	conflict_hunks () {
diff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh
index ef98d95..9be9ae3 100755
--- a/t/t5560-http-backend-noserver.sh
+++ b/t/t5560-http-backend-noserver.sh
@@ -5,7 +5,7 @@ test_description='test git-http-backend-noserver'
 
 HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY"
 
-test_have_prereq MINGW && export GREP_OPTIONS=-U
+test_have_prereq GREP_STRIPS_CR && export GREP_OPTIONS=-U
 
 run_backend() {
 	echo "$2" |
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 2d63307..1abea40 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -824,6 +824,7 @@ case $(uname -s) in
 	test_set_prereq MINGW
 	test_set_prereq NOT_CYGWIN
 	test_set_prereq SED_STRIPS_CR
+	test_set_prereq GREP_STRIPS_CR
 	;;
 *CYGWIN*)
 	test_set_prereq POSIXPERM
@@ -831,6 +832,7 @@ case $(uname -s) in
 	test_set_prereq NOT_MINGW
 	test_set_prereq CYGWIN
 	test_set_prereq SED_STRIPS_CR
+	test_set_prereq GREP_STRIPS_CR
 	;;
 *)
 	test_set_prereq POSIXPERM
-- 
1.8.3.2.0.13

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] t3032 - make compatible with systems using \r\n as a line ending
  2013-07-18 19:19     ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Ramsay Jones
@ 2013-07-18 21:47       ` Mark Levedahl
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Levedahl @ 2013-07-18 21:47 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Jonathan Nieder, git

On 07/18/2013 03:19 PM, Ramsay Jones wrote:
> Jonathan Nieder wrote:
>> Mark Levedahl wrote:
>>
>>> Subtests 6, 7, and 9 rely test that merge-recursive correctly
>>> ignores whitespace when so directed. Change the particular whitespace
>>> sequences to be ones that are not known line endings so the whitespace
>>> is not changed when being extracted by line oriented grep.
>> merge-recursive needs to be able to deal with \r at EOL, too, so if at
>> all possible I would prefer to see the test fixed to pass on Cygwin
>> some other way.
> Maybe use -U/--binary option to grep? Indeed, if you look at the top of
> that test file, you will see:
>
>      test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
>      test_have_prereq MINGW && export GREP_OPTIONS=-U
>
> which may explain why it works for me on MinGW, but not why it works on
> cygwin 1.5.
>
> ATB,
> Ramsay Jones
>
>
>
>
>
Thanks, hadn't noticed that, it leads to a much better patch.

Mark

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] test-lib.sh - define and use GREP_STRIPS_CR
  2013-07-18 21:44         ` [PATCH] test-lib.sh - define and use GREP_STRIPS_CR Mark Levedahl
@ 2013-07-20 19:41           ` Ramsay Jones
  2013-07-21 21:04             ` Junio C Hamano
  0 siblings, 1 reply; 14+ messages in thread
From: Ramsay Jones @ 2013-07-20 19:41 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: gitster, jrnieder, git

Mark Levedahl wrote:
> Define a common macro for grep needing -U to allow tests to not need
> to inquire of specific platforms needing this option. Change
> t3032 and t5560 to use this rather than testing explicitly for mingw.
> This fixes these two tests on Cygwin.
> 
> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
> ---
> This replaces my earlier patch against t3032 (8896b287 on pu)

Yep, this looks good and (as expected) it works on cygwin 1.5 too. :-D

Thanks.

ATB,
Ramsay Jones

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] test-lib.sh - define and use GREP_STRIPS_CR
  2013-07-20 19:41           ` Ramsay Jones
@ 2013-07-21 21:04             ` Junio C Hamano
  0 siblings, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2013-07-21 21:04 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Mark Levedahl, jrnieder, git

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Mark Levedahl wrote:
>> Define a common macro for grep needing -U to allow tests to not need
>> to inquire of specific platforms needing this option. Change
>> t3032 and t5560 to use this rather than testing explicitly for mingw.
>> This fixes these two tests on Cygwin.
>> 
>> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
>> ---
>> This replaces my earlier patch against t3032 (8896b287 on pu)
>
> Yep, this looks good and (as expected) it works on cygwin 1.5 too. :-D
>
> Thanks.

After this patch lands 'master', we may want to add a note to these
SED/GREP workarounds for CRLF platforms that we assume the platform
use GNU sed/grep.

Incidentally, don't we also need "unset SED_OPTIONS" in
t/test-lib.sh net to where we unset GREP_OPTIONS?

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-07-21 21:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-16 18:33 t3032 incompatible with Cygwin/Windows Mark Levedahl
2013-07-16 18:49 ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Mark Levedahl
2013-07-16 18:59   ` Jonathan Nieder
2013-07-16 19:44     ` Mark Levedahl
2013-07-16 20:26     ` Mark Levedahl
2013-07-16 20:32     ` Mark Levedahl
2013-07-17 19:33       ` Junio C Hamano
2013-07-18 21:44         ` [PATCH] test-lib.sh - define and use GREP_STRIPS_CR Mark Levedahl
2013-07-20 19:41           ` Ramsay Jones
2013-07-21 21:04             ` Junio C Hamano
2013-07-18 19:19     ` [PATCH] t3032 - make compatible with systems using \r\n as a line ending Ramsay Jones
2013-07-18 21:47       ` Mark Levedahl
2013-07-16 18:56 ` t3032 incompatible with Cygwin/Windows Jonathan Nieder
2013-07-18 19:11 ` Ramsay Jones

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).