Re: [PATCH] t7406: correct test case for submodule-update initial population
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Mar 22, 2017, 22:14 UTC
- Message-ID
- <20170322221414.GE26108@aiede.mtv.corp.google.com>
- In-Reply-To
- <CAGZ79kbFjCQB_k8E1dMVop_EGF6TpnY04U1NV60VmSs1zHOnZw@mail.gmail.com>
Stefan Beller wrote:
> On Wed, Mar 22, 2017 at 2:59 PM, Jeff King <peff@peff.net> wrote:
Show 14 quoted lines
>> sq=\'
>> test_expect_success '...' '
>> cat >expect <<-EOF
>> Execution of ${sq}false $submodulesha1${sq} ...
>> '
>>
>> but I'm not sure if that is any more readable.
>
> If I recall correctly, I made a big fuss about single quotes used correctly when
> writing that patch (which is why I may have lost track of the actual work there)
> to be told the one and only blessed way to use single quotes in our test suite.
>
> Your proposal to use ${sq} sounds good to me, though we did not
> follow through with it for some other reason. I can reroll with that, though.I don't know what you're referring to by only and blessed way, but it might be the following. If you want to use single-quotes on a command line using $sq, you would have to use eval:
eval "some_command ${sq}single-quoted argument${sq}"which is generally more complicated than doing the '\'' dance:
some_command '\''single-quoted argument'\''
But the example in this thread is different. In the here-document you are in an interpolated context so the ${sq} method or '\'' would work equally well.
Hope that helps, Jonathan