git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t3032 - make compatible with systems using \r\n as a line ending

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Jul 16, 2013, 20:32 UTC
Message-ID
<1374006769-1878-1-git-send-email-mlevedahl@gmail.com>
In-Reply-To
<20130716185933.GO14690@google.com>

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
Previous: Mark LevedahlNext: Junio C Hamano
Message 6 of 14 in “t3032 incompatible with Cygwin/Windows”
  1. Mark LevedahlJul 16, 2013
  2. t3032 - make compatible with systems using \r\n as a line endingMark Levedahl, Jul 16, 2013
  3. Jonathan NiederJul 16, 2013
  4. Mark LevedahlJul 16, 2013
  5. t3032 - make compatible with systems using \r\n as a line endingMark Levedahl, Jul 16, 2013
  6. t3032 - make compatible with systems using \r\n as a line endingMark Levedahl, Jul 16, 2013
  7. Junio C HamanoJul 17, 2013
  8. test-lib.sh - define and use GREP_STRIPS_CRMark Levedahl, Jul 18, 2013
  9. Ramsay JonesJul 20, 2013
  10. Junio C HamanoJul 21, 2013
  11. Ramsay JonesJul 18, 2013
  12. Mark LevedahlJul 18, 2013
  13. Jonathan NiederJul 16, 2013
  14. Ramsay JonesJul 18, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.