git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] test_ref_missing(): improve error message

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 27, 2026, 20:00 UTC
Message-ID
<xmqqld7ij4lg.fsf@gitster.g>
In-Reply-To
<e246ee6f3b11c231580752b6c94a57f31f449955.1793098652.git.phillip.wood@dunelm.org.uk>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 12 quoted lines
> 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.
Show 10 quoted lines
> 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.
Previous: Phillip WoodNext: Phillip Wood
Message 3 of 7 in “sequencer: fix cleanup of REBASE_HEAD and AUTO_MERGE”
  1. 0/3 sequencer: fix cleanup of REBASE_HEAD and AUTO_MERGEPhillip Wood, Oct 27, 2026
  2. 1/3 test_ref_missing(): improve error messagePhillip Wood, Oct 27, 2026
  3. Junio C HamanoOct 27, 2026
  4. 2/3 sequencer: remove REBASE_HEAD at the end of a rebasePhillip Wood, Oct 27, 2026
  5. Junio C HamanoOct 27, 2026
  6. 3/3 sequencer: remove AUTO_MERGE at the end of a rebasePhillip Wood, Oct 27, 2026
  7. Junio C HamanoOct 27, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.