Skip to contentSkip to conversation

t4012: Actually quote the sed script

PATCH Superseded Alexander Strasser 2 participants 3 messages Jun 15, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 t4012: Actually quote the sed script

The nested quoting is not needed in this cases, thus the previous version did work just fine. Never the less the usage is misleading, so just achieve nested quoting by using double quotes instead. Lower the probability of breakage in the future and make the code easier to read.

NOTE: Just dropping the single quotes around the sed arguments would
have also been possible.

---
 t/t4012-diff-binary.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
t/t4012-diff-binary.sh +2 -2
index 3c54269..60c2f6c 100755
@@ -64,7 +64,7 @@ test_expect_success 'apply --numstat understands diff --binary format' '
 # apply needs to be able to skip the binary material correctly
 # in order to report the line number of a corrupt patch.
 test_expect_success 'apply detecting corrupt patch correctly' '
-	 git diff | sed -e 's/-CIT/xCIT/' >broken &&
+	 git diff | sed -e "s/-CIT/xCIT/" >broken &&
 	 if git apply --stat --summary broken 2>detected
 	 then
 		echo unhappy - should have detected an error
@@ -79,7 +79,7 @@ test_expect_success 'apply detecting corrupt patch correctly' '
 '
 
 test_expect_success 'apply detecting corrupt patch correctly' '
-	 git diff --binary | sed -e 's/-CIT/xCIT/' >broken &&
+	 git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
 	 if git apply --stat --summary broken 2>detected
 	 then
 		echo unhappy - should have detected an error
Signature · 1 line
1.7.10.2.552.gaa3bb87
#1 lore raw
Quoted 5 lines · Alexander Strasser

The nested quoting is not needed in this cases, thus the previous version did work just fine. Never the less the usage is misleading, so just achieve nested quoting by using double quotes instead. Lower the probability of breakage in the future and make the code easier to read.

Hi,

I have some spelling corrections (minor, but since you intend to re-roll anyway, I'll post them), and one more thing which could be corrected (below).

3/6: s/Never the less/Nevertheless/
4/6: s/masquerading/masking/ (masquerade means to "mask oneself")

t/t4012-diff-binary.sh test_expect_success 'apply detecting corrupt patch correctly' ' · line 85

Quoted 12 lines
t/t4012-diff-binary.sh +1 -1
 	 if git apply --stat --summary broken 2>detected
 	 then
 		echo unhappy - should have detected an error
@@ -79,7 +79,7 @@ test_expect_success 'apply detecting corrupt patch correctly' '
 '
 
 test_expect_success 'apply detecting corrupt patch correctly' '
-	 git diff --binary | sed -e 's/-CIT/xCIT/' >broken &&
+	 git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
 	 if git apply --stat --summary broken 2>detected
 	 then
 		echo unhappy - should have detected an error

I think this can be changed to:
test_must_fail git apply --stat --summary broken 2>detected

-
Zbyszek

#2 lore raw

Hi Zbigniew,

Quoted 1 line · Zbigniew Jędrzejewski-Szmek

On 07/12/2012 12:12 AM, Alexander Strasser wrote:

[...]

Quoted 6 lines

I have some spelling corrections (minor, but since you intend to re-roll anyway, I'll post them), and one more thing which could be corrected (below).

3/6: s/Never the less/Nevertheless/
4/6: s/masquerading/masking/ (masquerade means to "mask oneself")

[...]

Quoted 5 lines

t/t4012-diff-binary.sh test_expect_success 'apply --numstat understands diff --binary format' ' · line 70

Quoted 3 lines
t/t4012-diff-binary.sh +0 -0
 	 if git apply --stat --summary broken 2>detected
 	 then
 		echo unhappy - should have detected an error

I think this can be changed to:

   test_must_fail git apply --stat --summary broken 2>detected

Thank you for your sharp feedback. I will implement the requested
changes for the re-roll.

Alexander