All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Elia Pinto <gitter.spiros@gmail.com>,
	"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Please pull the patch series "use the $( ... ) construct for command substitution"
Date: Thu, 15 May 2014 09:45:22 +0200	[thread overview]
Message-ID: <vpq38gbfpt9.fsf@anie.imag.fr> (raw)
In-Reply-To: <CAPig+cT-Nn_hnqE0CK=c0-9+_QG9hpsp9j4cERsvvjwkrLmSMw@mail.gmail.com> (Eric Sunshine's message of "Wed, 14 May 2014 17:21:00 -0400")

Eric Sunshine <sunshine@sunshineco.com> 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/

      reply	other threads:[~2014-05-15  7:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 15:23 Please pull the patch series "use the $( ... ) construct for command substitution" Elia Pinto
2014-05-14 17:14 ` Matthieu Moy
2014-05-14 21:21   ` Eric Sunshine
2014-05-15  7:45     ` Matthieu Moy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpq38gbfpt9.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitter.spiros@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.