From: Junio C Hamano <gitster@pobox.com>
To: Andrew Chitester <andchi@fastmail.com>
Cc: git@vger.kernel.org
Subject: Re: [GSoC PATCH] t1420-lost-found.sh: use test_path_is_file for error logging
Date: Mon, 05 Jan 2026 12:24:17 +0900 [thread overview]
Message-ID: <xmqq4ip0n3mm.fsf@gitster.g> (raw)
In-Reply-To: <20260104161536.45384-1-andchi@fastmail.com> (Andrew Chitester's message of "Sun, 4 Jan 2026 11:15:04 -0500")
Andrew Chitester <andchi@fastmail.com> writes:
> This test will fail silently without giving any error message. Use
> test_path_is_file in place of test -f to ensure this test errors with a
> message.
>
> Signed-off-by: Andrew Chitester <andchi@fastmail.com>
> ---
> t/t1420-lost-found.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t1420-lost-found.sh b/t/t1420-lost-found.sh
> index 2fb2f44f02..5fbb1d10ed 100755
> --- a/t/t1420-lost-found.sh
> +++ b/t/t1420-lost-found.sh
> @@ -29,8 +29,8 @@ test_expect_success 'lost and found something' '
> git reset --hard HEAD^ &&
> git fsck --lost-found &&
> test 2 = $(ls .git/lost-found/*/* | wc -l) &&
> - test -f .git/lost-found/commit/$(cat lost-commit) &&
> - test -f .git/lost-found/other/$(cat lost-other)
> + test_path_is_file .git/lost-found/commit/$(cat lost-commit) &&
> + test_path_is_file .git/lost-found/other/$(cat lost-other)
> '
Looks correct, but given that what these tests want to ensure is
that underneath .git/lost-found there are only these two expected
files, I have to wonder if the output of "ls" here is expected to be
very stable. I.e. if we rewrote the whole thing to something like
...
ls .git/lost-found/*/* >actual &&
cat >expect <<-EOF &&
.git/lost-found/commit/$(cat lost-commit)
.git/lost-found/other/$(cat lost-other)
EOF
test_cmp expect actual
... would it be a more direct way to say that and is easier to
understand to our readers.
next prev parent reply other threads:[~2026-01-05 3:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 16:15 [GSoC PATCH] t1420-lost-found.sh: use test_path_is_file for error logging Andrew Chitester
2026-01-05 3:24 ` Junio C Hamano [this message]
2026-01-08 1:30 ` Andrew Chitester
2026-01-06 13:26 ` [GSoC PATCH v2 1/1] t1420: modernize the lost-found test Andrew Chitester
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=xmqq4ip0n3mm.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=andchi@fastmail.com \
--cc=git@vger.kernel.org \
/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.