From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
git@vger.kernel.org, "Jean-Rémy Falleri" <jr.falleri@gmail.com>
Subject: Re: [PATCH v2] git-difftool--helper: honor `--trust-exit-code` with `--dir-diff`
Date: Thu, 21 Mar 2024 14:50:13 +0100 [thread overview]
Message-ID: <Zfw7FUtDcKBaA0-6@tanuki> (raw)
In-Reply-To: <xmqqcys4fj15.fsf@gitster.g>
[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]
On Fri, Mar 08, 2024 at 02:36:22PM -0800, Junio C Hamano wrote:
> SZEDER Gábor <szeder.dev@gmail.com> writes:
>
> >> -test_expect_success 'difftool honors exit status if command not found' '
> >> - test_config difftool.nonexistent.cmd i-dont-exist &&
> >> - test_config difftool.trustExitCode false &&
> >> - test_must_fail git difftool -y -t nonexistent branch
> >> -'
> >> + test_expect_success "difftool ${opt} honors exit status if command not found" "
> >> + test_config difftool.nonexistent.cmd i-dont-exist &&
> >> + test_config difftool.trustExitCode false &&
> >> + if test "${opt}" = '--dir-diff'
> >
> > The quoting doesn't quite work here.
>
> Thanks for looking at them carefully.
>
> In general, when you want to interpolate an variable that exists
> outside test_expect_success, you should write it this way:
>
> for var in a "b c"
> do
> test_expect_success "message with $var interpolated" '
> command and "$var" as its argument
> '
> done
>
> The last parameter to test_expect_{success,failure} is eval'ed, so
> enclose it within a pair of single quotes, and let the eval to
> interpolate references to $variables at runtime (as opposed to when
> the parameters to test_expect_success are formulated) avoids a lot
> of surprises and headaches.
>
> Perhaps we should have something like the above as a hint in
> t/README?
Makes sense. I've sent a separate patch series addressing this issue in
[1].
Thanks!
Patrick
[1]: https://lore.kernel.org/git/cover.1711028473.git.ps@pks.im/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2024-03-21 13:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 11:09 Git difftool: interaction between --dir-diff and --trust-exit-code Jean-Rémy Falleri
2024-02-16 8:39 ` [PATCH] git-difftool--helper: honor `--trust-exit-code` with `--dir-diff` Patrick Steinhardt
2024-02-16 18:12 ` Junio C Hamano
2024-02-20 9:56 ` Patrick Steinhardt
2024-02-28 1:52 ` David Aguilar
2024-02-28 2:15 ` Junio C Hamano
2024-02-20 10:08 ` [PATCH v2] " Patrick Steinhardt
2024-03-08 22:12 ` SZEDER Gábor
2024-03-08 22:36 ` Junio C Hamano
2024-03-21 13:50 ` Patrick Steinhardt [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=Zfw7FUtDcKBaA0-6@tanuki \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jr.falleri@gmail.com \
--cc=szeder.dev@gmail.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 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 NNTP newsgroup(s).