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

Re: [PATCH 2/2] Add optional parameters to the diff option "--ignore-submodules"

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jun 24, 2010, 17:11 UTC
Message-ID
<4C2391CF.5090606@web.de>
In-Reply-To
<oyrgMnuxMzyEmKMa6Bb_rvLb_zp8WscXW73T03xzJ5_bpheAt9Hpcw@cipher.nrlssc.navy.mil>
Am 24.06.2010 16:23, schrieb Brandon Casey:
Show 19 quoted lines
> On 06/08/2010 11:31 AM, Jens Lehmann wrote:
> 
> Two things...
> 
>> diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh
>> index 83c1914..559b41e 100755
>> --- a/t/t4027-diff-submodule.sh
>> +++ b/t/t4027-diff-submodule.sh
>> @@ -103,9 +103,17 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
>>  	git diff HEAD >actual &&
>>  	sed -e "1,/^@@/d" actual >actual.body &&
>>  	expect_from_to >expect.body $subprev $subprev-dirty &&
>> -	test_cmp expect.body actual.body
>> +	test_cmp expect.body actual.body &&
>> +	git diff --ignore-submodules HEAD >actual2 &&
>> +	echo -n "" | test_cmp - actual2 &&
> 
> 'echo -n' is not portable (here, and below).  Please use printf
> instead.  Ditto for t4041
Thanks, I haven't been aware of that.
Show 13 quoted lines
>> +	git diff --ignore-submodules=untracked HEAD >actual3 &&
>> +	sed -e "1,/^@@/d" actual3 >actual3.body &&
>> +	expect_from_to >expect.body $subprev $subprev-dirty &&
>> +	test_cmp expect.body actual3.body &&
>> +	git diff --ignore-submodules=dirty HEAD >actual4 &&
>> +	echo -n "" | test_cmp - actual4
>>  '
>> -
>> +test_done
>    ^^^^^^^^^
> 
> Why is this test_done here?  There are additional tests after this point,
> and an additional call to test_done.

Grmph, this is a leftover from debugging :-( Thank you for spotting this one too!

As the patch introducing this is already in next, here is another one:
--------------------8<--------------------------
From: Jens Lehmann <Jens.Lehmann@web.de>
Date: Thu, 24 Jun 2010 19:01:27 +0200
Subject: [PATCH] t4027 & t4041: Fix use of "echo -n" and a premature "test_done"

Replace the non portable "echo -n" with "printf" and remove a premature "test_done".

Reported-by: Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 t/t4027-diff-submodule.sh        |   12 ++++++------
 t/t4041-diff-submodule-option.sh |   14 +++++++-------
 2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh
index 559b41e..3f2e591 100755
--- a/t/t4027-diff-submodule.sh
+++ b/t/t4027-diff-submodule.sh
@@ -105,15 +105,15 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
 	expect_from_to >expect.body $subprev $subprev-dirty &&
 	test_cmp expect.body actual.body &&
 	git diff --ignore-submodules HEAD >actual2 &&
-	echo -n "" | test_cmp - actual2 &&
+	printf "" | test_cmp - actual2 &&
 	git diff --ignore-submodules=untracked HEAD >actual3 &&
 	sed -e "1,/^@@/d" actual3 >actual3.body &&
 	expect_from_to >expect.body $subprev $subprev-dirty &&
 	test_cmp expect.body actual3.body &&
 	git diff --ignore-submodules=dirty HEAD >actual4 &&
-	echo -n "" | test_cmp - actual4
+	printf "" | test_cmp - actual4
 '
-test_done
+
 test_expect_success 'git diff HEAD with dirty submodule (index, refs match)' '
 	(
 		cd sub &&
@@ -139,11 +139,11 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
 	expect_from_to >expect.body $subprev $subprev-dirty &&
 	test_cmp expect.body actual.body &&
 	git diff --ignore-submodules=all HEAD >actual2 &&
-	echo -n "" | test_cmp - actual2 &&
+	printf "" | test_cmp - actual2 &&
 	git diff --ignore-submodules=untracked HEAD >actual3 &&
-	echo -n "" | test_cmp - actual3 &&
+	printf "" | test_cmp - actual3 &&
 	git diff --ignore-submodules=dirty HEAD >actual4 &&
-	echo -n "" | test_cmp - actual4
+	printf "" | test_cmp - actual4
 '

 test_expect_success 'git diff (empty submodule dir)' '
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index f44b906..7600ed1 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -207,17 +207,17 @@ EOF

 test_expect_success 'submodule contains untracked content (untracked ignored)' "
 	git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
-	echo -n '' | diff actual -
+	printf '' | diff actual -
 "

 test_expect_success 'submodule contains untracked content (dirty ignored)' "
 	git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
-	echo -n '' | diff actual -
+	printf '' | diff actual -
 "

 test_expect_success 'submodule contains untracked content (all ignored)' "
 	git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
-	echo -n '' | diff actual -
+	printf '' | diff actual -
 "

 test_expect_success 'submodule contains untracked and modifed content' "
@@ -240,13 +240,13 @@ EOF
 test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' "
 	echo new > sm1/foo6 &&
 	git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
-	echo -n '' | diff actual -
+	printf '' | diff actual -
 "

 test_expect_success 'submodule contains untracked and modifed content (all ignored)' "
 	echo new > sm1/foo6 &&
 	git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
-	echo -n '' | diff actual -
+	printf '' | diff actual -
 "

 test_expect_success 'submodule contains modifed content' "
@@ -295,7 +295,7 @@ EOF

 test_expect_success 'modified submodule contains untracked content (all ignored)' "
 	git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
-	echo -n '' | diff actual -
+	printf '' | diff actual -
 "

 test_expect_success 'modified submodule contains untracked and modifed content' "
@@ -331,7 +331,7 @@ EOF
 test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' "
 	echo modification >> sm1/foo6 &&
 	git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
-	echo -n '' | diff actual -
+	printf '' | diff actual -
 "

 test_expect_success 'modified submodule contains modifed content' "
-- 
1.7.1.716.g6c3d8
Previous: Brandon CaseyNext: Junio C Hamano
Message 5 of 14 in “Add optional parameters to the diff option "--ignore-submodules"”
  1. 0/2 Add optional parameters to the diff option "--ignore-submodules"Jens Lehmann, Jun 8, 2010
  2. 1/2 git diff: rename test that had a conflicting nameJens Lehmann, Jun 8, 2010
  3. 2/2 Add optional parameters to the diff option "--ignore-submodules"Jens Lehmann, Jun 8, 2010
  4. Brandon CaseyJun 24, 2010
  5. Jens LehmannJun 24, 2010
  6. Junio C HamanoJun 8, 2010
  7. Jens LehmannJun 8, 2010
  8. Johannes SchindelinJun 8, 2010
  9. Junio C HamanoJun 8, 2010
  10. Johannes SchindelinJun 8, 2010
  11. Johan HerlandJun 8, 2010
  12. Jens LehmannJun 8, 2010
  13. Johan HerlandJun 8, 2010
  14. Jens LehmannJun 9, 2010

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.