From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: git@vger.kernel.org, Long 76 <long76.git@mail.ru>,
Matt Hunter <m@lfurio.us>
Subject: Re: [PATCH 1/3] test_ref_missing(): improve error message
Date: Tue, 27 Oct 2026 13:00:59 -0700 [thread overview]
Message-ID: <xmqqld7ij4lg.fsf@gitster.g> (raw)
In-Reply-To: <e246ee6f3b11c231580752b6c94a57f31f449955.1793098652.git.phillip.wood@dunelm.org.uk> (Phillip Wood's message of "Tue, 27 Oct 2026 10:57:55 +0000")
Phillip Wood <phillip.wood123@gmail.com> writes:
> From: Phillip Wood <phillip.wood@dunelm.org.uk>
>
> If the ref being checked exists, then test_ref_missing() does not print
> the name of the ref in the error message. So, if there is more than
> one call to test_ref_missing() in a test, it is hard to understand
> which one failed by looking at the test output. Fix that by printing
> the name of the ref that erroneously exists.
>
> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> ---
> t/test-lib-functions.sh | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Makes sense.
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> index 09a41d51adc..b56b4f0a6c8 100644
> --- a/t/test-lib-functions.sh
> +++ b/t/test-lib-functions.sh
> @@ -292,18 +292,20 @@ test_ref_exists () {
> # a reference. This is preferable to `! test_ref_exists` as this function is
> # able to distinguish actually-missing references from other, generic errors.
> test_ref_missing () {
> + local refname
> + eval refname="\$$#"
OK, test_ref_exists is defined immediately before, so it probably is
safe to assume that the last parameter is the refname argument like
this patch does. And it would make the failure output much easier
to understand.
> - echo >&4 "test_ref_missing: reference exists"
> + echo >&4 "test_ref_missing: '$refname' exists"
Thanks.
next prev parent reply other threads:[~2026-10-27 20:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 10:57 [PATCH 0/3] sequencer: fix cleanup of REBASE_HEAD and AUTO_MERGE Phillip Wood
2026-10-27 10:57 ` [PATCH 1/3] test_ref_missing(): improve error message Phillip Wood
2026-10-27 20:00 ` Junio C Hamano [this message]
2026-10-27 10:57 ` [PATCH 2/3] sequencer: remove REBASE_HEAD at the end of a rebase Phillip Wood
2026-10-27 20:10 ` Junio C Hamano
2026-10-27 10:57 ` [PATCH 3/3] sequencer: remove AUTO_MERGE " Phillip Wood
2026-10-27 20:11 ` Junio C Hamano
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=xmqqld7ij4lg.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=long76.git@mail.ru \
--cc=m@lfurio.us \
--cc=phillip.wood123@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