Re: [PATCH] tests: fix syntax error in "Use advise() for hints" test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason wrote:

> Change the test introduced in the "Use advise() for hints" patch by
> Jonathan Nieder not to use '' for quotes inside '' delimited code.

Yikes.  Thanks for catching this.

> -test_expect_success 'advice from failed cherry-pick' '
> +test_expect_success 'advice from failed cherry-pick' "
[...]
>  	cat <<-EOF >expected &&
> -	error: could not apply $picked... picked
> +	error: could not apply \$picked... picked

Although the style you chose is arguably the least ugly, nested shell
interpolation can be hard to follow.  How about this?

-- 8< --
Subject: t3507 (cherry-pick): escape quotes in "Use advise()" test

Do not use unescaped '' quotes inside ''-delimited code.  Otherwise,
this test tries to read a file named "paths" in the test repository,
resulting in the error:

 t3507-cherry-pick-conflict.sh: 59: cannot open paths: No such file

Based-on-patch-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 t/t3507-cherry-pick-conflict.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 3f29594..6026e7e 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -50,8 +50,8 @@ test_expect_success 'advice from failed cherry-pick' '
 	cat <<-EOF >expected &&
 	error: could not apply $picked... picked
 	hint: after resolving the conflicts, mark the corrected paths
-	hint: with 'git add <paths>' or 'git rm <paths>'
-	hint: and commit the result with 'git commit -c $picked'
+	hint: with '\''git add <paths>'\'' or '\''git rm <paths>'\''
+	hint: and commit the result with '\''git commit -c $picked'\''
 	EOF
 	test_must_fail git cherry-pick picked 2>actual &&
 
-- 
1.7.2.1.544.ga752d.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]