{"thread":{"id":"64952","subject":"[GSOC PATCH] t2003: modernize test path helpers","startedAt":"2026-02-08T20:28:52Z","lastAt":"2026-02-09T08:35:54Z","messageCount":2,"participants":["Burak Kaan Karaçay","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"535488","messageId":"20260208202809.270523-1-bkkaracay@gmail.com","threadId":"64952","inReplyTo":null,"subject":"[GSOC PATCH] t2003: modernize test path helpers","fromName":"Burak Kaan Karaçay","fromEmail":"bkkaracay@gmail.com","sentAt":"2026-02-08T20:28:09Z","receivedAt":"2026-02-08T20:28:52Z","isPatch":true,"sender":{"key":"bkkaracay@gmail.com","avatar":"https://avatars.githubusercontent.com/u/29117336?v=4"},"body":"The old style 'test -f' and 'test -d' checks are silent on failure,\nwhich makes debugging difficult.\n\nReplace them with the 'test_path_is_*' helpers which provide verbose\nerror messages when a test fails.\n\nSigned-off-by: Burak Kaan Karaçay <bkkaracay@gmail.com>\n---\n t/t2003-checkout-cache-mkdir.sh | 49 ++++++++++++++++-----------------\n 1 file changed, 24 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh\nindex ff163cf675..5844389c88 100755\n--- a/t/t2003-checkout-cache-mkdir.sh\n+++ b/t/t2003-checkout-cache-mkdir.sh\n@@ -24,27 +24,27 @@ test_expect_success SYMLINKS 'have symlink in place where dir is expected.' '\n \tmkdir path2 &&\n \tln -s path2 path1 &&\n \tgit checkout-index -f -a &&\n-\ttest ! -h path1 && test -d path1 &&\n-\ttest -f path1/file1 && test ! -f path2/file1\n+\ttest_path_is_dir_not_symlink path1 &&\n+\ttest_path_is_file path1/file1 && test_path_is_missing path2/file1\n '\n \n test_expect_success 'use --prefix=path2/' '\n \trm -fr path0 path1 path2 &&\n \tmkdir path2 &&\n \tgit checkout-index --prefix=path2/ -f -a &&\n-\ttest -f path2/path0 &&\n-\ttest -f path2/path1/file1 &&\n-\ttest ! -f path0 &&\n-\ttest ! -f path1/file1\n+\ttest_path_is_file path2/path0 &&\n+\ttest_path_is_file path2/path1/file1 &&\n+\ttest_path_is_missing path0 &&\n+\ttest_path_is_missing path1/file1\n '\n \n test_expect_success 'use --prefix=tmp-' '\n \trm -fr path0 path1 path2 tmp* &&\n \tgit checkout-index --prefix=tmp- -f -a &&\n-\ttest -f tmp-path0 &&\n-\ttest -f tmp-path1/file1 &&\n-\ttest ! -f path0 &&\n-\ttest ! -f path1/file1\n+\ttest_path_is_file tmp-path0 &&\n+\ttest_path_is_file tmp-path1/file1 &&\n+\ttest_path_is_missing path0 &&\n+\ttest_path_is_missing path1/file1\n '\n \n test_expect_success 'use --prefix=tmp- but with a conflicting file and dir' '\n@@ -52,10 +52,10 @@ test_expect_success 'use --prefix=tmp- but with a conflicting file and dir' '\n \techo nitfol >tmp-path1 &&\n \tmkdir tmp-path0 &&\n \tgit checkout-index --prefix=tmp- -f -a &&\n-\ttest -f tmp-path0 &&\n-\ttest -f tmp-path1/file1 &&\n-\ttest ! -f path0 &&\n-\ttest ! -f path1/file1\n+\ttest_path_is_file tmp-path0 &&\n+\ttest_path_is_file tmp-path1/file1 &&\n+\ttest_path_is_missing path0 &&\n+\ttest_path_is_missing path1/file1\n '\n \n test_expect_success SYMLINKS 'use --prefix=tmp/orary/ where tmp is a symlink' '\n@@ -63,10 +63,10 @@ test_expect_success SYMLINKS 'use --prefix=tmp/orary/ where tmp is a symlink' '\n \tmkdir tmp1 tmp1/orary &&\n \tln -s tmp1 tmp &&\n \tgit checkout-index --prefix=tmp/orary/ -f -a &&\n-\ttest -d tmp1/orary &&\n-\ttest -f tmp1/orary/path0 &&\n-\ttest -f tmp1/orary/path1/file1 &&\n-\ttest -h tmp\n+\ttest_path_is_dir tmp1/orary &&\n+\ttest_path_is_file tmp1/orary/path0 &&\n+\ttest_path_is_file tmp1/orary/path1/file1 &&\n+\ttest_path_is_symlink tmp\n '\n \n test_expect_success SYMLINKS 'use --prefix=tmp/orary- where tmp is a symlink' '\n@@ -74,9 +74,9 @@ test_expect_success SYMLINKS 'use --prefix=tmp/orary- where tmp is a symlink' '\n \tmkdir tmp1 &&\n \tln -s tmp1 tmp &&\n \tgit checkout-index --prefix=tmp/orary- -f -a &&\n-\ttest -f tmp1/orary-path0 &&\n-\ttest -f tmp1/orary-path1/file1 &&\n-\ttest -h tmp\n+\ttest_path_is_file tmp1/orary-path0 &&\n+\ttest_path_is_file tmp1/orary-path1/file1 &&\n+\ttest_path_is_symlink tmp\n '\n \n test_expect_success SYMLINKS 'use --prefix=tmp- where tmp-path1 is a symlink' '\n@@ -84,10 +84,9 @@ test_expect_success SYMLINKS 'use --prefix=tmp- where tmp-path1 is a symlink' '\n \tmkdir tmp1 &&\n \tln -s tmp1 tmp-path1 &&\n \tgit checkout-index --prefix=tmp- -f -a &&\n-\ttest -f tmp-path0 &&\n-\ttest ! -h tmp-path1 &&\n-\ttest -d tmp-path1 &&\n-\ttest -f tmp-path1/file1\n+\ttest_path_is_file tmp-path0 &&\n+\ttest_path_is_dir_not_symlink tmp-path1 &&\n+\ttest_path_is_file tmp-path1/file1\n '\n \n test_expect_success 'apply filter from working tree .gitattributes with --prefix' '\n-- \n2.52.0\n\n"},{"id":"535502","messageId":"xmqqqzqu71qw.fsf@gitster.g","threadId":"64952","inReplyTo":"20260208202809.270523-1-bkkaracay@gmail.com","subject":"Re: [GSOC PATCH] t2003: modernize test path helpers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-09T08:35:51Z","receivedAt":"2026-02-09T08:35:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Burak Kaan Karaçay <bkkaracay@gmail.com> writes:\n\n> Subject: Re: [GSOC PATCH] t2003: modernize test path helpers\n\nWhat we see in the patch are more uses of test path helpers, and\nnothing in these path helpers are changed at all.\n\n    Subject: t2003: modernize path existence checks using test helpers\n\nor something like that, perhaps.\n\n> -\ttest ! -h path1 && test -d path1 &&\n> -\ttest -f path1/file1 && test ! -f path2/file1\n> +\ttest_path_is_dir_not_symlink path1 &&\n> +\ttest_path_is_file path1/file1 && test_path_is_missing path2/file1\n\nThe above is a faithful rewrite, but as a separate patch to\nfollow-up this file, the last line should be split into two, having\none command on each line.\n\nAll changes in this patch looked good.  Will queue.\n\nThanks.\n"}]}