{"thread":{"id":"65194","subject":"[PATCH v2] t4200: replace test -f and test -d with test_path_exists","startedAt":"2026-03-10T08:43:51Z","lastAt":"2026-03-10T08:43:51Z","messageCount":1,"participants":["PRASHANT S BISHT"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"538364","messageId":"20260310084338.49923-1-prashantjee2025@gmail.com","threadId":"65194","inReplyTo":null,"subject":"[PATCH v2] t4200: replace test -f and test -d with test_path_exists","fromName":"PRASHANT S BISHT","fromEmail":"prashantjee2025@gmail.com","sentAt":"2026-03-10T08:43:38Z","receivedAt":"2026-03-10T08:43:51Z","isPatch":true,"sender":{"key":"prashantjee2025@gmail.com","avatar":"https://avatars.githubusercontent.com/u/213211543?v=4"},"body":"Replace old-style path existence checks with the modern test_path_exists\nhelper function that provides clearer diagnostic messages on failure.\n\nThis conversion focuses on test assertions within test_expect_success\nblocks where a missing path genuinely indicates a test failure,\nrather than on control-flow checks (such as those in test_lazy_prereq\nblocks) where missing paths are expected in certain environments.\n\nSigned-off-by: PRASHANT S BISHT <prashantjee2025@gmail.com>\n---\n t/t4200-rerere.sh | 26 +++++++++++++-------------\n 1 file changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\nindex 204325f4d5..71a49bee56 100755\n--- a/t/t4200-rerere.sh\n+++ b/t/t4200-rerere.sh\n@@ -72,7 +72,7 @@ test_expect_success 'nothing recorded without rerere' '\n \trm -rf .git/rr-cache &&\n \tgit config rerere.enabled false &&\n \ttest_must_fail git merge first &&\n-\t! test -d .git/rr-cache\n+\t! test_path_exists .git/rr-cache\n '\n \n test_expect_success 'activate rerere, old style (conflicting merge)' '\n@@ -84,8 +84,8 @@ test_expect_success 'activate rerere, old style (conflicting merge)' '\n \tsha1=$(sed \"s/\t.*//\" .git/MERGE_RR) &&\n \trr=.git/rr-cache/$sha1 &&\n \tgrep \"^=======\\$\" $rr/preimage &&\n-\t! test -f $rr/postimage &&\n-\t! test -f $rr/thisimage\n+\t! test_path_exists $rr/postimage &&\n+\t! test_path_exists $rr/thisimage\n '\n \n test_expect_success 'rerere.enabled works, too' '\n@@ -110,8 +110,8 @@ test_expect_success 'set up rr-cache' '\n \n test_expect_success 'rr-cache looks sane' '\n \t# no postimage or thisimage yet\n-\t! test -f $rr/postimage &&\n-\t! test -f $rr/thisimage &&\n+\t! test_path_exists $rr/postimage &&\n+\t! test_path_exists $rr/thisimage &&\n \n \t# preimage has right number of lines\n \tcnt=$(sed -ne \"/^<<<<<<</,/^>>>>>>>/p\" $rr/preimage | wc -l) &&\n@@ -167,7 +167,7 @@ test_expect_success 'first postimage wins' '\n \tgit show first:a1 | sed \"s/To die: t/To die! T/\" >expect &&\n \n \tgit commit -q -a -m \"prefer first over second\" &&\n-\ttest -f $rr/postimage &&\n+\ttest_path_exists $rr/postimage &&\n \n \toldmtimepost=$(test-tool chmtime --get -60 $rr/postimage) &&\n \n@@ -190,14 +190,14 @@ test_expect_success 'rerere clear' '\n \tmv $rr/postimage .git/post-saved &&\n \techo \"$sha1\ta1\" | tr \"\\012\" \"\\000\" >.git/MERGE_RR &&\n \tgit rerere clear &&\n-\t! test -d $rr\n+\t! test_path_exists $rr\n '\n \n test_expect_success 'leftover directory' '\n \tgit reset --hard &&\n \tmkdir -p $rr &&\n \ttest_must_fail git merge first &&\n-\ttest -f $rr/preimage\n+\ttest_path_exists $rr/preimage\n '\n \n test_expect_success 'missing preimage' '\n@@ -205,7 +205,7 @@ test_expect_success 'missing preimage' '\n \tmkdir -p $rr &&\n \tcp .git/post-saved $rr/postimage &&\n \ttest_must_fail git merge first &&\n-\ttest -f $rr/preimage\n+\ttest_path_exists $rr/preimage\n '\n \n test_expect_success 'set up for garbage collection tests' '\n@@ -230,16 +230,16 @@ test_expect_success 'set up for garbage collection tests' '\n \n test_expect_success 'gc preserves young or recently used records' '\n \tgit rerere gc &&\n-\ttest -f $rr/preimage &&\n-\ttest -f $rr2/preimage\n+\ttest_path_exists $rr/preimage &&\n+\ttest_path_exists $rr2/preimage\n '\n \n test_expect_success 'old records rest in peace' '\n \ttest-tool chmtime =$just_over_60_days_ago $rr/postimage &&\n \ttest-tool chmtime =$just_over_15_days_ago $rr2/preimage &&\n \tgit rerere gc &&\n-\t! test -f $rr/preimage &&\n-\t! test -f $rr2/preimage\n+\t! test_path_exists $rr/preimage &&\n+\t! test_path_exists $rr2/preimage\n '\n \n rerere_gc_custom_expiry_test () {\n-- \n2.50.1 (Apple Git-155)\n\n"}]}