From: Junio C Hamano Date: Mon, 14 Sep 2026 15:42:56 GMT Subject: Re: [PATCH] t7610: use test_path_is_* helpers Message-ID: In-Reply-To: <20260914-t7610-test-path-helpers-v1-1-4824812314c7@tanishqsingh.com> Tanishq Singh via B4 Relay writes: > echo d | git mergetool a/a/file.txt && > - ! test -f a/a/file.txt && > + ! test_path_is_file a/a/file.txt && This is wrong. Consider why you would prefer test_path_is_file() over test -f in the first place. The goal is to be much louder when the expectation is not met, while remaining as silent as test -f in the happy case. This grabs the attention of those running tests. We want to be loud when things break, and silent otherwise. test_path_is_file() expects file X to exist and will not complain when X is a file. However, the test "! test -f a/a/file.txt" in this case expects something totally different. It ensures that such a path does not exist. It is an error if a/a/file.txt exists here. You want the helper to be loud when the file exists, and silent when it does not. test_path_is_file() called on a/a/file.txt, with or without a leading !, behaves incorrectly for the purpose of this conversion, even though the polarity of the returned status may be correct (i.e., test_path_is_file(), just like test -f, exits with status 0 when the file a/a/file.txt exists, and a leading ! negates it, making the test line fail when a/a/file.txt exists). If the expectation is that a/a/file.txt does not exist, use test_path_is_missing(). Please read through t/test-lib.sh and t/test-lib-functions.sh to familiarize yourself with the helpers these files offer before going further. Thanks.