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

Re: [PATCH v2] t4200: replace test -f and test -d with test_path_exists

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 16, 2026, 06:37 UTC
Message-ID
<CAPig+cRp+U8gWT7JkUdoaeyVVXGvq_iB8X3Ppj9Q862CiJFZmg@mail.gmail.com>
In-Reply-To
<20260316042248.63278-1-prashantjee2025@gmail.com>

On Mon, Mar 16, 2026 at 12:23 AM PRASHANT S BISHT <prashantjee2025@gmail.com> wrote:

Show 15 quoted lines
> Replace old-style path existence checks with the modern test_path_exists
> helper function that provides clearer diagnostic messages on failure.
>
> This conversion focuses on test assertions within test_expect_success
> blocks where a missing path genuinely indicates a test failure,
> rather than on control-flow checks (such as those in test_lazy_prereq
> blocks) where missing paths are expected in certain environments.
>
> Signed-off-by: PRASHANT S BISHT <prashantjee2025@gmail.com>
> ---
> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
> @@ -72,7 +72,7 @@ test_expect_success 'nothing recorded without rerere' '
>         test_must_fail git merge first &&
> -       ! test -d .git/rr-cache
> +       ! test_path_exists .git/rr-cache

Unfortunately, this conversion and all of the others involving `!` are incorrect. Take a look at the implementations of `test_path_exists` and other `test_path_*` functions in t/test-lib/functions.sh to see if you can figure out why and what the proper change should be. (Hint: We want test failures to be noisy and explanatory, while successes should be silent.)

Previous: PRASHANT S BISHT
Message 2 of 2 in “t4200: replace test -f and test -d with test_path_exists”
  1. t4200: replace test -f and test -d with test_path_existsPRASHANT S BISHT, Mar 16, 2026
  2. Eric SunshineMar 16, 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.