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

Re: [PATCH] t0004: replace test -e with test_path_exists

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 9, 2026, 21:14 UTC
Message-ID
<xmqq4imo4sf1.fsf@gitster.g>
In-Reply-To
<20260309173635.29683-1-prashantjee2025@gmail.com>
PRASHANT S BISHT <prashantjee2025@gmail.com> writes:
> -test_lazy_prereq WRITE_TREE_OUT 'test -e "$TRASH_DIRECTORY"/out.write-tree'
> +test_lazy_prereq WRITE_TREE_OUT 'test_path_exists "$TRASH_DIRECTORY/out.write-tree"'

I suspect this is utterly wrong. As you wrote in the proposed log message, test_path_exists is *NOT* about checking if the path exists. It rather is about *expecting* for the path to exist, and fail *LOUDLY* if it does not.

You need to _think_ if we want a LOUD failure when somebody checks if a path exists and conditionally skip setting a test prerequisite when the path does not exist. The original code is trying to be quiet, as the check is done not because existence of the checked path is good and lack of it is a test failure. Lack of the path is expected on places where the prerequisite is not set, and that by itself is not a test failure that you want a LOUD report about.

Previous: PRASHANT S BISHTNext: Jeff King
Message 2 of 5 in “t0004: replace test -e with test_path_exists”
  1. t0004: replace test -e with test_path_existsPRASHANT S BISHT, Mar 9, 2026
  2. Junio C HamanoMar 9, 2026
  3. Jeff KingMar 9, 2026
  4. Junio C HamanoMar 9, 2026
  5. t4200: convert test -[df] checks to test_path_* helpersPRASHANT S BISHT, Mar 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.