From: Junio C Hamano <gitster@pobox.com>
To: Pablo Sabater <pabloosabaterr@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [GSoC PATCH v3] t9200: replace test -f/-d with modern path helpers
Date: Wed, 11 Mar 2026 10:52:44 -0700 [thread overview]
Message-ID: <xmqqwlzip82b.fsf@gitster.g> (raw)
In-Reply-To: <20260309230134.758107-1-pabloosabaterr@gmail.com> (Pablo Sabater's message of "Tue, 10 Mar 2026 00:01:34 +0100")
Pablo Sabater <pabloosabaterr@gmail.com> writes:
> Replace old style 'test -f' and 'test -d' with helpers
> 'test_path_is_file' and 'test_path_is_dir' respectively,
> which make debugging a failing test easier by loudly
> reporting what expectation was not met.
Well explained.
> The instances were found with:
>
> git grep "test -[efd]" t/
People seem to add the above to their test-path helper patches, but
unless the coverage of the work is fairly thorough and you want to
say "all the similar issues should be found with this command and I
addressed all of them", I do not see much point saying how you found
one of them and addressed it.
You could have used "git grep -e <pattern> -- t/\*.sh", or you could
have been working to fix something in t9200 and noticed these while
you were doing something else to the file.
I do not see it as too huge a deal and it is probably not a cause to
send in another iteration once it is already written, though.
> Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
> ---
> t/t9200-git-cvsexportcommit.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
> index a44eabf0d8..4507e8e6db 100755
> --- a/t/t9200-git-cvsexportcommit.sh
> +++ b/t/t9200-git-cvsexportcommit.sh
> @@ -31,7 +31,7 @@ export CVSROOT CVSWORK GIT_DIR
> rm -rf "$CVSROOT" "$CVSWORK"
>
> cvs init &&
> -test -d "$CVSROOT" &&
> +test_path_is_dir "$CVSROOT" &&
> cvs -Q co -d "$CVSWORK" . &&
> echo >empty &&
> git add empty &&
Our test-path helpers should work even outside test_expect_*
functions, so this is not wrong per-se, but it somehow looks a bit
unusual. A related clean-up would be to wrap the CVS initialization
part inside another "do we even have a working CVS installation to
make it worth our time testing 'git cvsexportcommit' command?"
check, i.e.,
if ! cvs init || ! test -d "$CVSROOT" || ! cvs -Q co -d "$CVSWORK" .
then
skip_all="cvs repository set-up fails"
test_done
fi
and then move the git initialization part to its own test, e.g.,
test_expect_success 'git setup' '
echo >empty &&
git add empty &&
git commit -q -a -m Initial
'
> @@ -303,7 +303,7 @@ test_expect_success 're-commit a removed filename which remains in CVS attic' '
> git commit -m "Added attic_gremlin" &&
> git cvsexportcommit -w "$CVSWORK" -c HEAD &&
> (cd "$CVSWORK" && cvs -Q update -d) &&
> - test -f "$CVSWORK/attic_gremlin"
> + test_path_is_file "$CVSWORK/attic_gremlin"
> '
OK.
>
> # the state of the CVS sandbox may be indeterminate for ' space'
next prev parent reply other threads:[~2026-03-11 17:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 15:09 [GSoC PATCH] t9200: use helpers to replace test -f <path> and test -d <path> Pablo Sabater
2026-03-09 15:20 ` Junio C Hamano
2026-03-09 15:39 ` Pablo
2026-03-09 16:28 ` [GSoC PATCH v2] t9200: replace test -f/-d with modern path helpers Pablo Sabater
2026-03-09 21:03 ` Junio C Hamano
2026-03-09 22:54 ` Pablo
2026-03-09 23:01 ` [GSoC PATCH v3] " Pablo Sabater
2026-03-09 23:26 ` Junio C Hamano
2026-03-11 10:59 ` Pablo
2026-03-11 17:52 ` Junio C Hamano [this message]
2026-03-11 19:06 ` Pablo
2026-03-11 19:42 ` Junio C Hamano
2026-03-11 19:49 ` Pablo
2026-03-11 20:31 ` Junio C Hamano
2026-03-12 17:33 ` [GSoC PATCH v4] t9200: replace test -f with modern path helper Pablo Sabater
2026-03-12 17:37 ` 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=xmqqwlzip82b.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pabloosabaterr@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.