From: Junio C Hamano <gitster@pobox•com>
To: Deveshi Dwivedi <deveshigurgaon@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] [GSoC] t5403: use test_path_is_file instead of test -f
Date: Mon, 05 Jan 2026 19:34:11 +0900 [thread overview]
Message-ID: <xmqqpl7ol55o.fsf@gitster.g> (raw)
In-Reply-To: <CAG7UgEQeOJq0S87btjy8TT9as10bCAJWKEUTfNafa811iM8qwA@mail.gmail.com> (Deveshi Dwivedi's message of "Mon, 5 Jan 2026 11:28:11 +0530")
Deveshi Dwivedi <deveshigurgaon@gmail•com> writes:
> I can update the clone test to follow the same pattern as the other tests:
> read old new flag <clone3/.git/post-checkout.args &&
> test "$old" = $(test_oid zero) &&
> test "$new" = $(git rev-parse HEAD) &&
> test "$flag" = 1
>
> Does this sound reasonable?
The open-coded four command sequence above is repeatedly used
throughout this test script. I find them quite ugly but more
importantly, they have exactly the same downside as your patch is
trying to correct---it is almost impossible to tell where the test
failed and how from its output, because these "test" will simply
fail silently.
If I were in your position, I'd probably:
(1) first declare a victory with the current patch.
(2) as a separate series, on top of (1), prepare a patch that
replaces these "read old new flag, then check $old, $new, and
$flag" sequence with a helper function that can be called like
so:
check_post_checkout clone3/.git/post-checkout.args \
"$(test_oid zero)" "$(git rev-parse HEAD" 1
Leave the implementation of check_post_checkout just like the
original, i.e., "read old new flag, and then test these three
things, failing silently". The point of this step is not about
improving the tests; the point is to make it easier to improve
in the next step, without changing what the tests do.
(3) then update the implementation of check_post_checkout, with the
implementation of the post-checkout hook also updated to match,
so that the helper now looks like this:
check_post_checkout () {
test "$#" = 4 || BUG "check_post_checkout takes 4 args"
echo "old=$2 new=$3 flag=$4" >expect &&
test_cmp expect "$1"
}
Hmm?
next prev parent reply other threads:[~2026-01-05 10:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-29 18:57 [PATCH] [GSoC] t5403: use test_path_is_file instead of test -f Deveshi Dwivedi
2026-01-01 0:27 ` Junio C Hamano
2026-01-05 5:58 ` Deveshi Dwivedi
2026-01-05 10:34 ` Junio C Hamano [this message]
2026-01-05 11:47 ` Deveshi Dwivedi
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=xmqqpl7ol55o.fsf@gitster.g \
--to=gitster@pobox$(echo .)com \
--cc=deveshigurgaon@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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