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

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

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
May 15, 2014, 07:45 UTC
Message-ID
<vpq38gbfpt9.fsf@anie.imag.fr>
In-Reply-To
<CAPig+cT-Nn_hnqE0CK=c0-9+_QG9hpsp9j4cERsvvjwkrLmSMw@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 9 quoted lines
> 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.
Show 9 quoted lines
>> 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:
Show 5 quoted lines
> >  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/
Previous: Eric Sunshine
Message 4 of 4 in “Please pull the patch series "use the $( ... ) construct for command substitution"”
  1. Elia PintoMay 14, 2014
  2. Matthieu MoyMay 14, 2014
  3. Eric SunshineMay 14, 2014
  4. Matthieu MoyMay 15, 2014

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.