Re: [PATCH v4 8/8] [Newcomer] t7004: Use single quotes instead of double quotes

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

 



On Tue, Aug 6, 2024 at 12:35 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:
> > As a practical example, consider a test with a body like this:
> >
> >     echo nothing >nothing &&
> >     git add nothing &&
> >     git commit -m nothing &&
> >     hash=$(git rev-parse HEAD) &&
> >     ...
> >
> > If this body is inside a double-quoted string, then `$(git rev-parse
> > HEAD)` will be evaluated and its value assigned to `hash` _before_
> > test_expect_success() is called,
>
> I know it is just your finger slipping, but the variable "hash" is
> not assigned to before test_expect_success is called even with the
> body inside dq.

Ugh, you're quite correct, of course. The "and its value assigned to
`hash`" part was one of those last-moment-edits which come back to
haunt the author. That's not so much a finger slip as an outright
bungle. Thanks for catching and correcting this.

> What happens is that the value of HEAD is expanded in the string
> that will be evaled by test_expect_success so the 4th line in the
> above becomes "hash=3469a23659d8197190d2765cf9f31dec5ab602fa &&";
> as the resulting string is then eval'ed by test_expect_success,
> the end result is as you descirbed, i.e., ...
> ... $hash does not get the name of the commit object resulting from
> the "git commit" command before it.

Including an actual example of the resulting string, as you did here,
does a much better job of illustrating the issue than my bungled
last-moment-edit.





[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]

  Powered by Linux