Re: Please pull the patch series "use the $( ... ) construct for command substitution"

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

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> On Wed, May 14, 2014 at 1:14 PM, Matthieu Moy
>
>> I do not understand the use of the \ in front of the ` in the original
>> code.
>
> The second argument of test_expect_success is double-quoted, so a bare
> `...` would be evaluated before test_expect_success is even invoked.
> Quoting it as \'...\' correctly suppresses the automatic evaluation,
> giving test_expect_success the opportunity to evaluate it on-demand.

Ah, of course, you're right.

>> The correct code should be
>>
>>         test x\"$(sed -n -e 4p < file)\" = x4 &&
>>
>> I guess.
>
> Same issue. The $(...) is being evaluated even before
> test_expect_success is invoked. Better would be to suspend evaluation
> via \$(...) to allow test_expect_success to evaluate it on-demand.

OK, then the correct code should be

        test x\"\$(sed -n -e 4p < file)\" = x4 &&

And the other attempt was close:

> >  test_expect_success 'verify pre-merge ancestry' "
> > -       test x\`git rev-parse --verify refs/heads/svn^2\` = \
> > -            x\`git rev-parse --verify refs/heads/merge\` &&
> > +       test x\$(git rev-parse --verify refs/heads/svn^2\) = \
> > +            x\$(git rev-parse --verify refs/heads/merge\) &&

\-escaping the $ was right, but the \) should be a single ).

In any case, the fact that we need to discuss this supports my claim
"this should be reviewed as a separate series".

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
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]