From: Junio C Hamano <gitster@pobox.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: "Patrick Steinhardt" <ps@pks.im>,
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: Fri, 08 Mar 2024 14:36:22 -0800 [thread overview]
Message-ID: <xmqqcys4fj15.fsf@gitster.g> (raw)
In-Reply-To: <20240308221229.GA1908@szeder.dev> ("SZEDER Gábor"'s message of "Fri, 8 Mar 2024 23:12:29 +0100")
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?
next prev parent reply other threads:[~2024-03-08 22:36 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 [this message]
2024-03-21 13:50 ` Patrick Steinhardt
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=xmqqcys4fj15.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jr.falleri@gmail.com \
--cc=ps@pks.im \
--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 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.