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.)