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.