git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brandon Williams <bmwill@google.com>,
	David Turner <novalis@novalis.org>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH 4/4] unpack-trees: support super-prefix option
Date: Wed, 11 Jan 2017 15:57:59 -0800	[thread overview]
Message-ID: <CAGZ79kb30nG-TAnXuUKM+exxoh816sRogwhU-hjaL+onmFR-qQ@mail.gmail.com> (raw)
In-Reply-To: <xmqqh955mb1p.fsf@gitster.mtv.corp.google.com>

On Wed, Jan 11, 2017 at 3:28 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>>> Preparing the expected output "expect" outside test_expect_success
>>> block is also old-school.  Move it inside the new test?
>>
>> I looked into that. What is our current stance on using single/double quotes?
>
> Using dq around executable part, i.e.
>
>         test_expect_success title "
>                 echo \"'foo'\"
>         "
>
> is a million-times more grave sin even if the test initially does
> not refer to any variable in its body.  Somebody will eventually
> need to add a line that refers to a variable and either forgets to
> quote \$ in front or properly quotes it.

agreed.

>  The former makes the
> variable interpolated while the arguments to the test_expect_success
> is prepared (which is a bug) and the latter makes the result quite
> ugly, like so:
>
>         test_expect_success title "
>                 sq=\' var=foo &&
>                 echo \"\${sq}\$value\${sq}\"
>         "
>
> Enclosing the body always in sq-pair does mean something ugly like
> this from the beginning once you need to use sq inside:
>
>         test_expect_success title '
>                 sq='\'' &&
>                 echo "${sq}foo${sq}"
>         '

This one fails
error: bug in the test script: broken &&-chain:
                sq=' &&
                echo "${sq}foo${sq}"
both other occurrences of using ${sq} are defining sq outside
(one as sq=\' and the other as sq="'")

So I think we either have to keep sq out of the test,
    sq="'"
    test_expect_success title '
         echo "${sq}foo${sq}"
    '

or do the echo/printf trick inside:

    test_expect_success title '
         sq=$(echo -e "\x27") &&
         echo "${sq}foo${sq}"
    '

Eh, I just realize the '\'' works inside here-doc, too.
Nevermind then, I'll resend it with just quoted sq in the here-doc then.

Thanks,
Stefan

  reply	other threads:[~2017-01-11 23:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10  1:45 [RFC/PATCH 0/4] working tree operations: support superprefix Stefan Beller
2017-01-10  1:45 ` [PATCH 1/4] read-tree: use OPT_BOOL instead of OPT_SET_INT Stefan Beller
2017-01-10 20:41   ` Junio C Hamano
2017-01-10  1:45 ` [PATCH 2/4] t1000: modernize style Stefan Beller
2017-01-10 20:37   ` Junio C Hamano
2017-01-10 20:43     ` Stefan Beller
2017-01-10 22:01       ` Junio C Hamano
2017-01-10  1:45 ` [PATCH 3/4] t1001: " Stefan Beller
2017-01-10  1:45 ` [PATCH 4/4] unpack-trees: support super-prefix option Stefan Beller
2017-01-11 21:32   ` Junio C Hamano
2017-01-11 22:12     ` Stefan Beller
2017-01-11 23:28       ` Junio C Hamano
2017-01-11 23:57         ` Stefan Beller [this message]
2017-01-12  0:12     ` [PATCHv2 " Stefan Beller
2017-01-12 21:40       ` Junio C Hamano
2017-01-12 22:19         ` Stefan Beller
     [not found] ` <152c0fbf-084c-847f-2a30-a45ea3dd26f2@gmail.com>
2017-01-13 17:56   ` [RFC/PATCH 0/4] working tree operations: support superprefix Brian J. Davis

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CAGZ79kb30nG-TAnXuUKM+exxoh816sRogwhU-hjaL+onmFR-qQ@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=novalis@novalis.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).