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

Re: [PATCH] [GSoC] t5403: use test_path_is_file instead of test -f

From
Deveshi Dwivedi <deveshigurgaon@gmail.com>
Date
Jan 5, 2026, 11:47 UTC
Message-ID
<CAG7UgES1AETfjyhCG2BSTrch+YgVSquJz193rDvpb3cKBfBEkg@mail.gmail.com>
In-Reply-To
<xmqqpl7ol55o.fsf@gitster.g>
Show 7 quoted lines
> 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.
>
I understand, this does reintroduce the same debuggability issue.
> If I were in your position, I'd probably:
>
>  (1) first declare a victory with the current patch.
>
Agreed, I will keep the current patch as is.
Show 25 quoted lines
>  (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?
I understand, I will follow up with a separate series along these lines.

Thanks, Deveshi

Previous: Junio C Hamano
Message 5 of 5 in “[GSoC] t5403: use test_path_is_file instead of test -f”
  1. [GSoC] t5403: use test_path_is_file instead of test -fDeveshi Dwivedi, Dec 29, 2025
  2. Junio C HamanoJan 1, 2026
  3. Deveshi DwivediJan 5, 2026
  4. Junio C HamanoJan 5, 2026
  5. Deveshi DwivediJan 5, 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.