{"thread":{"id":"62273","subject":"[PATCH] t7300-clean.sh: use test_path_* helper functions","startedAt":"2024-10-07T19:19:19Z","lastAt":"2024-10-09T18:24:55Z","messageCount":15,"participants":["Samuel Adekunle Abraham via GitGitGadget","Usman Akinyemi","Junio C Hamano","Samuel Abraham","Patrick Steinhardt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"504351","messageId":"pull.1811.git.1728328755490.gitgitgadget@gmail.com","threadId":"62273","inReplyTo":null,"subject":"[PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Samuel Adekunle Abraham via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-10-07T19:19:15Z","receivedAt":"2024-10-07T19:19:19Z","isPatch":true,"sender":{"key":"name:Samuel Adekunle Abraham","avatar":null},"body":"From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n\nThe test_path_* helper functions provide error messages which show the cause\nof the test failures. Hence they are used to replace every instance of\ntest - [def] uses in the script.\n\nSigned-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n---\n    [Outreachy] [PATCH] t7300-clean.sh: replace instances of test - [def]\n    with test_path_* helper functions.\n    \n    The test_path_* helper functions provide error messages which show the\n    cause of the test failure should a failure occur. This is more useful\n    and helpful when debugging errors.\n    \n    Signed-off-by: Abraham Samuel Adekunle abrahamadekunle50@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1811%2Fdevdekunle%2Fupdate_tests-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1811/devdekunle/update_tests-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1811\n\n t/t7300-clean.sh | 370 +++++++++++++++++++++++------------------------\n 1 file changed, 185 insertions(+), 185 deletions(-)\n\ndiff --git a/t/t7300-clean.sh b/t/t7300-clean.sh\nindex 0aae0dee670..5c97eb0dfe9 100755\n--- a/t/t7300-clean.sh\n+++ b/t/t7300-clean.sh\n@@ -29,15 +29,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so &&\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so &&\n \tgit update-index --no-skip-worktree .gitignore &&\n \tgit checkout .gitignore\n '\n@@ -47,15 +47,15 @@ test_expect_success 'git clean' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -64,15 +64,15 @@ test_expect_success 'git clean src/' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean src/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -81,15 +81,15 @@ test_expect_success 'git clean src/ src/' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean src/ src/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -98,16 +98,16 @@ test_expect_success 'git clean with prefix' '\n \tmkdir -p build docs src/test &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n \t(cd src/ && git clean) &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f src/test/1.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file src/test/1.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -163,16 +163,16 @@ test_expect_success 'git clean -d with prefix and path' '\n \tmkdir -p build docs src/feature &&\n \ttouch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&\n \t(cd src/ && git clean -d feature/) &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest ! -f src/feature/file.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_missing src/feature/file.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -182,16 +182,16 @@ test_expect_success SYMLINKS 'git clean symbolic link' '\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tln -s docs/manual.txt src/part4.c &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -f src/part4.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing src/part4.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -199,13 +199,13 @@ test_expect_success 'git clean with wildcard' '\n \n \ttouch a.clean b.clean other.c &&\n \tgit clean \"*.clean\" &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.clean &&\n-\ttest ! -f b.clean &&\n-\ttest -f other.c\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.clean &&\n+\ttest_path_is_missing b.clean &&\n+\ttest_path_is_file other.c\n \n '\n \n@@ -214,15 +214,15 @@ test_expect_success 'git clean -n' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -n &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -231,15 +231,15 @@ test_expect_success 'git clean -d' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -248,16 +248,16 @@ test_expect_success 'git clean -d src/ examples/' '\n \tmkdir -p build docs examples &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&\n \tgit clean -d src/ examples/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -f examples/1.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing examples/1.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -266,15 +266,15 @@ test_expect_success 'git clean -x' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -x &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -283,15 +283,15 @@ test_expect_success 'git clean -d -x' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -x &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -300,15 +300,15 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -x -e src &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -317,15 +317,15 @@ test_expect_success 'git clean -X' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -X &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -334,15 +334,15 @@ test_expect_success 'git clean -d -X' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -X &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -351,15 +351,15 @@ test_expect_success 'git clean -d -X with ignored tracked directory' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -X -e src &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -382,29 +382,29 @@ test_expect_success 'clean.requireForce and -n' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -n &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n test_expect_success 'clean.requireForce and -f' '\n \n \tgit clean -f &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -453,11 +453,11 @@ test_expect_success 'nested git work tree' '\n \t\ttest_commit deeply.nested deeper.world\n \t) &&\n \tgit clean -f -d &&\n-\ttest -f foo/.git/index &&\n-\ttest -f foo/hello.world &&\n-\ttest -f baz/boo/.git/index &&\n-\ttest -f baz/boo/deeper.world &&\n-\t! test -d bar\n+\ttest_path_is_file foo/.git/index &&\n+\ttest_path_is_file foo/hello.world &&\n+\ttest_path_is_file baz/boo/.git/index &&\n+\ttest_path_is_file baz/boo/deeper.world &&\n+\ttest_path_is_missing bar\n '\n \n test_expect_success 'should clean things that almost look like git but are not' '\n@@ -624,9 +624,9 @@ test_expect_success 'force removal of nested git work tree' '\n \t\ttest_commit deeply.nested deeper.world\n \t) &&\n \tgit clean -f -f -d &&\n-\t! test -d foo &&\n-\t! test -d bar &&\n-\t! test -d baz\n+\ttest_path_is_missing foo &&\n+\ttest_path_is_missing bar &&\n+\ttest_path_is_missing baz\n '\n \n test_expect_success 'git clean -e' '\n@@ -638,10 +638,10 @@ test_expect_success 'git clean -e' '\n \t\ttouch known 1 2 3 &&\n \t\tgit add known &&\n \t\tgit clean -f -e 1 -e 2 &&\n-\t\ttest -e 1 &&\n-\t\ttest -e 2 &&\n-\t\t! (test -e 3) &&\n-\t\ttest -e known\n+\t\ttest_path_exists 1 &&\n+\t\ttest_path_exists 2 &&\n+\t\ttest_path_is_missing 3 &&\n+\t\ttest_path_exists known\n \t)\n '\n \n@@ -649,7 +649,7 @@ test_expect_success SANITY 'git clean -d with an unreadable empty directory' '\n \tmkdir foo &&\n \tchmod a= foo &&\n \tgit clean -dfx foo &&\n-\t! test -d foo\n+\ttest_path_is_missing foo\n '\n \n test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' '\n\nbase-commit: 90fe3800b92a49173530828c0a17951abd30f0e1\n-- \ngitgitgadget\n"},{"id":"504368","messageId":"CAPSxiM8SjJwb6x2bhCd4xsYLiNk+KhWYna7-rZhdNGpYNV1tLg@mail.gmail.com","threadId":"62273","inReplyTo":"pull.1811.git.1728328755490.gitgitgadget@gmail.com","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Usman Akinyemi","fromEmail":"usmanakinyemi202@gmail.com","sentAt":"2024-10-07T23:01:20Z","receivedAt":"2024-10-07T23:01:32Z","isPatch":true,"sender":{"key":"usmanakinyemi202@gmail.com","avatar":"https://avatars.githubusercontent.com/u/86585626?v=4"},"body":"On Mon, Oct 7, 2024 at 7:19 PM Samuel Adekunle Abraham via\nGitGitGadget <gitgitgadget@gmail.com> wrote:\n>\n> From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n>\n> The test_path_* helper functions provide error messages which show the cause\n> of the test failures. Hence they are used to replace every instance of\n> test - [def] uses in the script.\nMaybe also adding what they are being replaced with might make the\ndescription much clearer.\n>\n> Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n> ---\n>     [Outreachy] [PATCH] t7300-clean.sh: replace instances of test - [def]\n>     with test_path_* helper functions.\nHello Samuel,\n\nGood Job here, just a simple observation.\nI think it might be much clearer if you used test -(d|e|f) instead of\ntest - [def], as it much clearer.\nOverall it looks good to me.\n>\n>     The test_path_* helper functions provide error messages which show the\n>     cause of the test failure should a failure occur. This is more useful\n>     and helpful when debugging errors.\n>\n>     Signed-off-by: Abraham Samuel Adekunle abrahamadekunle50@gmail.com\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1811%2Fdevdekunle%2Fupdate_tests-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1811/devdekunle/update_tests-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/1811\n>\n>  t/t7300-clean.sh | 370 +++++++++++++++++++++++------------------------\n>  1 file changed, 185 insertions(+), 185 deletions(-)\n>\n> diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh\n> index 0aae0dee670..5c97eb0dfe9 100755\n> --- a/t/t7300-clean.sh\n> +++ b/t/t7300-clean.sh\n> @@ -29,15 +29,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so &&\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so &&\n>         git update-index --no-skip-worktree .gitignore &&\n>         git checkout .gitignore\n>  '\n> @@ -47,15 +47,15 @@ test_expect_success 'git clean' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -64,15 +64,15 @@ test_expect_success 'git clean src/' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean src/ &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -81,15 +81,15 @@ test_expect_success 'git clean src/ src/' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean src/ src/ &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -98,16 +98,16 @@ test_expect_success 'git clean with prefix' '\n>         mkdir -p build docs src/test &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n>         (cd src/ && git clean) &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f src/test/1.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_file src/test/1.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -163,16 +163,16 @@ test_expect_success 'git clean -d with prefix and path' '\n>         mkdir -p build docs src/feature &&\n>         touch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&\n>         (cd src/ && git clean -d feature/) &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test -f src/part3.c &&\n> -       test ! -f src/feature/file.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_file src/part3.c &&\n> +       test_path_is_missing src/feature/file.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -182,16 +182,16 @@ test_expect_success SYMLINKS 'git clean symbolic link' '\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         ln -s docs/manual.txt src/part4.c &&\n>         git clean &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test ! -f src/part4.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_missing src/part4.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -199,13 +199,13 @@ test_expect_success 'git clean with wildcard' '\n>\n>         touch a.clean b.clean other.c &&\n>         git clean \"*.clean\" &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.clean &&\n> -       test ! -f b.clean &&\n> -       test -f other.c\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.clean &&\n> +       test_path_is_missing b.clean &&\n> +       test_path_is_file other.c\n>\n>  '\n>\n> @@ -214,15 +214,15 @@ test_expect_success 'git clean -n' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -n &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_file src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -231,15 +231,15 @@ test_expect_success 'git clean -d' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -d &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test ! -d docs &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_missing docs &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -248,16 +248,16 @@ test_expect_success 'git clean -d src/ examples/' '\n>         mkdir -p build docs examples &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&\n>         git clean -d src/ examples/ &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test ! -f examples/1.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_missing examples/1.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -266,15 +266,15 @@ test_expect_success 'git clean -x' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -x &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test ! -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_missing obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -283,15 +283,15 @@ test_expect_success 'git clean -d -x' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -d -x &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test ! -d docs &&\n> -       test ! -f obj.o &&\n> -       test ! -d build\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_missing docs &&\n> +       test_path_is_missing obj.o &&\n> +       test_path_is_missing build\n>\n>  '\n>\n> @@ -300,15 +300,15 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -d -x -e src &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test -f src/part3.c &&\n> -       test ! -d docs &&\n> -       test ! -f obj.o &&\n> -       test ! -d build\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.out &&\n> +       test_path_is_file src/part3.c &&\n> +       test_path_is_missing docs &&\n> +       test_path_is_missing obj.o &&\n> +       test_path_is_missing build\n>\n>  '\n>\n> @@ -317,15 +317,15 @@ test_expect_success 'git clean -X' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -X &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test ! -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_file src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_missing obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -334,15 +334,15 @@ test_expect_success 'git clean -d -X' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -d -X &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test ! -f obj.o &&\n> -       test ! -d build\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_file src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_missing obj.o &&\n> +       test_path_is_missing build\n>\n>  '\n>\n> @@ -351,15 +351,15 @@ test_expect_success 'git clean -d -X with ignored tracked directory' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -d -X -e src &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test ! -f obj.o &&\n> -       test ! -d build\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_missing obj.o &&\n> +       test_path_is_missing build\n>\n>  '\n>\n> @@ -382,29 +382,29 @@ test_expect_success 'clean.requireForce and -n' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -n &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file Makefile &&\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_file a.out &&\n> +       test_path_is_file src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n>  test_expect_success 'clean.requireForce and -f' '\n>\n>         git clean -f &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test -f obj.o &&\n> -       test -f build/lib.so\n> +       test_path_is_file README &&\n> +       test_path_is_file src/part1.c &&\n> +       test_path_is_file src/part2.c &&\n> +       test_path_is_missing a.out &&\n> +       test_path_is_missing src/part3.c &&\n> +       test_path_is_file docs/manual.txt &&\n> +       test_path_is_file obj.o &&\n> +       test_path_is_file build/lib.so\n>\n>  '\n>\n> @@ -453,11 +453,11 @@ test_expect_success 'nested git work tree' '\n>                 test_commit deeply.nested deeper.world\n>         ) &&\n>         git clean -f -d &&\n> -       test -f foo/.git/index &&\n> -       test -f foo/hello.world &&\n> -       test -f baz/boo/.git/index &&\n> -       test -f baz/boo/deeper.world &&\n> -       ! test -d bar\n> +       test_path_is_file foo/.git/index &&\n> +       test_path_is_file foo/hello.world &&\n> +       test_path_is_file baz/boo/.git/index &&\n> +       test_path_is_file baz/boo/deeper.world &&\n> +       test_path_is_missing bar\n>  '\n>\n>  test_expect_success 'should clean things that almost look like git but are not' '\n> @@ -624,9 +624,9 @@ test_expect_success 'force removal of nested git work tree' '\n>                 test_commit deeply.nested deeper.world\n>         ) &&\n>         git clean -f -f -d &&\n> -       ! test -d foo &&\n> -       ! test -d bar &&\n> -       ! test -d baz\n> +       test_path_is_missing foo &&\n> +       test_path_is_missing bar &&\n> +       test_path_is_missing baz\n>  '\n>\n>  test_expect_success 'git clean -e' '\n> @@ -638,10 +638,10 @@ test_expect_success 'git clean -e' '\n>                 touch known 1 2 3 &&\n>                 git add known &&\n>                 git clean -f -e 1 -e 2 &&\n> -               test -e 1 &&\n> -               test -e 2 &&\n> -               ! (test -e 3) &&\n> -               test -e known\n> +               test_path_exists 1 &&\n> +               test_path_exists 2 &&\n> +               test_path_is_missing 3 &&\n> +               test_path_exists known\n>         )\n>  '\n>\n> @@ -649,7 +649,7 @@ test_expect_success SANITY 'git clean -d with an unreadable empty directory' '\n>         mkdir foo &&\n>         chmod a= foo &&\n>         git clean -dfx foo &&\n> -       ! test -d foo\n> +       test_path_is_missing foo\n>  '\n>\n>  test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' '\n>\n> base-commit: 90fe3800b92a49173530828c0a17951abd30f0e1\n> --\n> gitgitgadget\n>\n"},{"id":"504371","messageId":"xmqq34l75pr7.fsf@gitster.g","threadId":"62273","inReplyTo":"pull.1811.git.1728328755490.gitgitgadget@gmail.com","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-10-08T01:48:12Z","receivedAt":"2024-10-08T01:48:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Samuel Adekunle Abraham via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n>\n> The test_path_* helper functions provide error messages which show the cause\n> of the test failures.\n\n> Hence they are used to replace every instance of\n> test - [def] uses in the script.\n\nIt is unclear the use of present tense \"they are used\" describes the\nstatus quo, or the way you wish the test script were written.\n\nThe usual way to compose a log message of this project is to\n\n - Give an observation on how the current system work in the present\n   tense (so no need to say \"Currently X is Y\", just \"X is Y\"), and\n   discuss what you perceive as a problem in it.\n\n - Propose a solution (optional---often, problem description\n   trivially leads to an obvious solution in reader's minds).\n\n - Give commands to the codebase to \"become like so\".\n\nin this order.  \n\nAlso, for a patch like this one, which is rather large, repetitious,\nand tire reviewers to miss simple typos easily, giving a procedure\nto mechanically validate the patch would help.  Instead of having to\nmatch up \"test -f\" that was removed with \"test_is_file\" that was\nadded, while ensuring the pathname given to them are the same, a\nreader can reason about what the mechanical rewrite is doing, and\nwhen the reader is convinced that the mechanical rewrite is doing\nthe right thing, being able to mechanically compare the result of\nthe procedure with the result of applying a patch is a really\npowerful thing.\n\nI probably would have written your two paragraphs more like the\nfirst two paragraphs below, followed by the validation procedure,\nlike this:\n\n    This test script uses \"test -[edf]\", but when a test fails\n    because a file given to \"test -f\" does not exist, it fails\n    silently.\n\n    Use test_path_* helpers, which are designed to give better error\n    messages when their expectations are not met.\n\n    If you pass the current test script through\n\n\tsed -e 's/^\\(\t*\\)test -f /\\1test_path_is_file /' \\\n\t    -e 's/^\\(\t*\\)test -d /\\1test_path_is_dir /' \\\n\t    -e 's/^\\(\t*\\)test -e /\\1test_path_exists /' \\\n\t    -e 's/^\\(\t*\\)! test -[edf] /\\1test_path_is_missing /' \\\n\t    -e 's/^\\(\t*\\)test ! -[edf] /\\1test_path_is_missing /'\n\n    and then compare the result with the result of applying this\n    patch, you will see an instance of \"! (test -e 3)\", which was\n    manually replaced with \"test_path_is_missing 3\", and everything\n    else should match.\n\nAnd I did perform the sed script, aka \"how would I reproduce what is\nin this patch\" procedure, and compared the result with this patch.\nThe patch seems to be doing the right thing.\n\nManual validation is still needed for \"test ! -f foo\".  If the\noriginal expects 'foo' to be gone, and has a reason to expect 'foo'\nto be a file when the code being tested is broken, then rewriting it\ninto \"test_path_is_missing\" is OK.  But otherwise, the original\nwould have been happy when 'foo' existed as a directory and\nrewriting it into \"test_path_is_missing\" is not quite right.\n\nThis check cannot be done mechanically, unfortunately.  Hits from\n\n   $ git show | grep -e 'test ! -[df]'\n\nneed to be eyeballed to make sure that it is reasonable to rewrite\n\"test ! -f foo\" into \"test_path_is_missing foo\".\n\nFor example:\n\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean &&\n> ...\n> -\ttest ! -f a.out &&\n> -\ttest ! -f src/part3.c &&\n\nthis test creates a.out and src/part3.c as regular files before\nrunning \"git clean\", so the expected failure modes do not include\na.out to be a directory (which would also make \"test ! -f a.out\"\nhappy), and rewriting it to \"test_path_is_missing a.out\" is fine.\n\nI did *not* go through all the instances of test_path_is_missing\nin the postimage of this patch.  Instead of forcing reviewers to\ndo so on their own, mentioning that the author did that already\nwould probably help the process.\n\nThanks.\n"},{"id":"504391","messageId":"CADYq+faT1J7cj3v=q+aJbUrVUc-0AHP6DwDh7kXbQ5TrL4tinQ@mail.gmail.com","threadId":"62273","inReplyTo":"xmqq34l75pr7.fsf@gitster.g","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Samuel Abraham","fromEmail":"abrahamadekunle50@gmail.com","sentAt":"2024-10-08T05:12:34Z","receivedAt":"2024-10-08T05:12:46Z","isPatch":true,"sender":{"key":"abrahamadekunle50@gmail.com","avatar":"https://avatars.githubusercontent.com/u/110066922?v=4"},"body":"On Tue, Oct 8, 2024 at 2:48 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Samuel Adekunle Abraham via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n>\n> > From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n> >\n> > The test_path_* helper functions provide error messages which show the cause\n> > of the test failures.\n>\n> > Hence they are used to replace every instance of\n> > test - [def] uses in the script.\n>\n> It is unclear the use of present tense \"they are used\" describes the\n> status quo, or the way you wish the test script were written.\n>\n> The usual way to compose a log message of this project is to\n>\n>  - Give an observation on how the current system work in the present\n>    tense (so no need to say \"Currently X is Y\", just \"X is Y\"), and\n>    discuss what you perceive as a problem in it.\n>\n>  - Propose a solution (optional---often, problem description\n>    trivially leads to an obvious solution in reader's minds).\n>\n>  - Give commands to the codebase to \"become like so\".\n>\n> in this order.\n>\n> Also, for a patch like this one, which is rather large, repetitious,\n> and tire reviewers to miss simple typos easily, giving a procedure\n> to mechanically validate the patch would help.  Instead of having to\n> match up \"test -f\" that was removed with \"test_is_file\" that was\n> added, while ensuring the pathname given to them are the same, a\n> reader can reason about what the mechanical rewrite is doing, and\n> when the reader is convinced that the mechanical rewrite is doing\n> the right thing, being able to mechanically compare the result of\n> the procedure with the result of applying a patch is a really\n> powerful thing.\n>\n> I probably would have written your two paragraphs more like the\n> first two paragraphs below, followed by the validation procedure,\n> like this:\n>\n>     This test script uses \"test -[edf]\", but when a test fails\n>     because a file given to \"test -f\" does not exist, it fails\n>     silently.\n>\n>     Use test_path_* helpers, which are designed to give better error\n>     messages when their expectations are not met.\n>\n>     If you pass the current test script through\n>\n>         sed -e 's/^\\(   *\\)test -f /\\1test_path_is_file /' \\\n>             -e 's/^\\(   *\\)test -d /\\1test_path_is_dir /' \\\n>             -e 's/^\\(   *\\)test -e /\\1test_path_exists /' \\\n>             -e 's/^\\(   *\\)! test -[edf] /\\1test_path_is_missing /' \\\n>             -e 's/^\\(   *\\)test ! -[edf] /\\1test_path_is_missing /'\n>\n>     and then compare the result with the result of applying this\n>     patch, you will see an instance of \"! (test -e 3)\", which was\n>     manually replaced with \"test_path_is_missing 3\", and everything\n>     else should match.\n>\n> And I did perform the sed script, aka \"how would I reproduce what is\n> in this patch\" procedure, and compared the result with this patch.\n> The patch seems to be doing the right thing.\n>\n> Manual validation is still needed for \"test ! -f foo\".  If the\n> original expects 'foo' to be gone, and has a reason to expect 'foo'\n> to be a file when the code being tested is broken, then rewriting it\n> into \"test_path_is_missing\" is OK.  But otherwise, the original\n> would have been happy when 'foo' existed as a directory and\n> rewriting it into \"test_path_is_missing\" is not quite right.\n>\n> This check cannot be done mechanically, unfortunately.  Hits from\n>\n>    $ git show | grep -e 'test ! -[df]'\n>\n> need to be eyeballed to make sure that it is reasonable to rewrite\n> \"test ! -f foo\" into \"test_path_is_missing foo\".\n>\n> For example:\n>\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean &&\n> > ...\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n>\n> this test creates a.out and src/part3.c as regular files before\n> running \"git clean\", so the expected failure modes do not include\n> a.out to be a directory (which would also make \"test ! -f a.out\"\n> happy), and rewriting it to \"test_path_is_missing a.out\" is fine.\n>\n> I did *not* go through all the instances of test_path_is_missing\n> in the postimage of this patch.  Instead of forcing reviewers to\n> do so on their own, mentioning that the author did that already\n> would probably help the process.\n>\n> Thanks.\n\nHi Junio,\nThank you very much for your time and very detailed review. I will\nmake corrections in my next patch.\n"},{"id":"504406","messageId":"CADYq+fYZSGBTnO+dM+MtHj=oUMqDWt+6wu-wEzwfWQJkSomkWA@mail.gmail.com","threadId":"62273","inReplyTo":"xmqq34l75pr7.fsf@gitster.g","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Samuel Abraham","fromEmail":"abrahamadekunle50@gmail.com","sentAt":"2024-10-08T08:58:44Z","receivedAt":"2024-10-08T08:58:56Z","isPatch":true,"sender":{"key":"abrahamadekunle50@gmail.com","avatar":"https://avatars.githubusercontent.com/u/110066922?v=4"},"body":"On Tue, Oct 8, 2024 at 2:48 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Samuel Adekunle Abraham via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n>\n> > From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n> >\n> Manual validation is still needed for \"test ! -f foo\".  If the\n> original expects 'foo' to be gone, and has a reason to expect 'foo'\n> to be a file when the code being tested is broken, then rewriting it\n> into \"test_path_is_missing\" is OK.  But otherwise, the original\n> would have been happy when 'foo' existed as a directory and\n> rewriting it into \"test_path_is_missing\" is not quite right.\n>\n> This check cannot be done mechanically, unfortunately.  Hits from\n>\n>    $ git show | grep -e 'test ! -[df]'\n>\n> need to be eyeballed to make sure that it is reasonable to rewrite\n> \"test ! -f foo\" into \"test_path_is_missing foo\".\n>\n> For example:\n>\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean &&\n> > ...\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n>\n> this test creates a.out and src/part3.c as regular files before\n> running \"git clean\", so the expected failure modes do not include\n> a.out to be a directory (which would also make \"test ! -f a.out\"\n> happy), and rewriting it to \"test_path_is_missing a.out\" is fine.\n>\n\nHi Junio,\nThanks again for your time and review.\nI have gone through all the instances of \"test ! - [df]\" and for each\ntest case where \"test ! -f foo\" was used, foo was first created as a\nregular file in the control flow before \"git clean\" was called and is\nexpected not to exist afterwards.\na few more examples are to the one you referenced above are shown below;\n\n>         mkdir -p build docs src/test &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n>         (cd src/ && git clean) &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test ! -f src/part3.c &&\n\nand\n\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -d -X -e src &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test -f a.out &&\n> -       test ! -f src/part3.c &&\n> -       test -f docs/manual.txt &&\n> -       test ! -f obj.o &&\n\nAlso for the tests where \"test ! -d foo\" was used, the control flow\nfollowed similar pattern as mentioned above where foo was created as a\ndirectory and then \"git clean -d\" was called. The control flow\nexpected foo to be a directory which could have been removed\nafterwards as can be seen below.\n\n> @@ -300,15 +300,15 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '\n>         mkdir -p build docs &&\n>         touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>         git clean -d -x -e src &&\n> -       test -f Makefile &&\n> -       test -f README &&\n> -       test -f src/part1.c &&\n> -       test -f src/part2.c &&\n> -       test ! -f a.out &&\n> -       test -f src/part3.c &&\n> -       test ! -d docs &&\n> -       test ! -f obj.o &&\n> -       test ! -d build\n\nand\n\n>  test_expect_success 'should clean things that almost look like git but are not' '\n> @@ -624,9 +624,9 @@ test_expect_success 'force removal of nested git work tree' '\n>                 test_commit deeply.nested deeper.world\n>         ) &&\n>         git clean -f -f -d &&\n> -       ! test -d foo &&\n> -       ! test -d bar &&\n> -       ! test -d baz\n\n This was the reason for replacing \"test ! -[df]\" with\n\"test_path_is_missing\" where I think is appropriate. I will appreciate\nit and be very grateful if test instances in this script where\n\"test_path_is_missing\" is inappropriate to be used are pointed out by\nother maintainers as well.\nThanks once again for your time.\n"},{"id":"504416","messageId":"pull.1811.v2.git.1728390135644.gitgitgadget@gmail.com","threadId":"62273","inReplyTo":"pull.1811.git.1728328755490.gitgitgadget@gmail.com","subject":"[PATCH v2] t7300-clean.sh: use test_path_* helper functions for error logging","fromName":"Samuel Adekunle Abraham via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-10-08T12:22:15Z","receivedAt":"2024-10-08T12:22:19Z","isPatch":true,"sender":{"key":"name:Samuel Adekunle Abraham","avatar":null},"body":"From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n\nThis test script uses \"test - [def]\", but when a test fails because\nthe file passed to it does not exist,\nit fails silently without an error message.\nUse test_path_* helper functions, which are designed to give better\nerror messages when their expectations are not met.\n\nSigned-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n---\n    [Outreachy][PATCH] t7300-clean.sh: use test_path_* helper functions for\n    error logging\n    \n    This test script uses \"test - [def]\", but when a test fails because the\n    file passed to it does not exist, it fails silently without an error\n    message.\n    \n    Use test_path_* helper functions, which are designed to give better\n    error messages when their expectations are not met.\n    \n    I have added a mechanical validation that applies the same\n    transformation done in this patch, when the script is passed to a sed\n    script as shown below\n    \n    #!/bin/bash\n    sed -e 's/^\\(\t*\\)test -f /\\1test_path_is_file /' \\\n        -e 's/^\\(\t*\\)test -d /\\1test_path_is_dir /' \\\n        -e 's/^\\(\t*\\)test -e /\\1test_path_exists /' \\\n        -e 's/^\\(\t*\\)! test -[edf] /\\1test_path_is_missing /' \\\n        -e 's/^\\(\t*\\)test ! -[edf] /\\1test_path_is_missing /' \\\n           \"$1\" >foo.sh\n    \n    \n    Reviewers can use the sed script to transform the original test script\n    and compare the results in foo.sh with the results of applying this\n    patch You will see an instance of \"! (test -e 3)\" which was manually\n    replaced with \"test_path_is_missing\", and everything else should match.\n    I have carefully studied the instances where \"test ! - [df] foo\" were\n    used in the script to make sure that the test instances were expecting a\n    file or a directory to not exist as the case may be before replacing\n    with \"test_path_is_missing\".\n    \n    Signed-off-by: Abraham Samuel Adekunle abrahamadekunle50@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1811%2Fdevdekunle%2Fupdate_tests-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1811/devdekunle/update_tests-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1811\n\nRange-diff vs v1:\n\n 1:  fef842b7013 ! 1:  62d57156dcf t7300-clean.sh: use test_path_* helper functions\n     @@ Metadata\n      Author: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n      \n       ## Commit message ##\n     -    t7300-clean.sh: use test_path_* helper functions\n     +    t7300-clean.sh: use test_path_* helper functions for error logging\n      \n     -    The test_path_* helper functions provide error messages which show the cause\n     -    of the test failures. Hence they are used to replace every instance of\n     -    test - [def] uses in the script.\n     +    This test script uses \"test - [def]\", but when a test fails because\n     +    the file passed to it does not exist,\n     +    it fails silently without an error message.\n     +    Use test_path_* helper functions, which are designed to give better\n     +    error messages when their expectations are not met.\n      \n          Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n      \n\n\n t/t7300-clean.sh | 370 +++++++++++++++++++++++------------------------\n 1 file changed, 185 insertions(+), 185 deletions(-)\n\ndiff --git a/t/t7300-clean.sh b/t/t7300-clean.sh\nindex 0aae0dee670..5c97eb0dfe9 100755\n--- a/t/t7300-clean.sh\n+++ b/t/t7300-clean.sh\n@@ -29,15 +29,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so &&\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so &&\n \tgit update-index --no-skip-worktree .gitignore &&\n \tgit checkout .gitignore\n '\n@@ -47,15 +47,15 @@ test_expect_success 'git clean' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -64,15 +64,15 @@ test_expect_success 'git clean src/' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean src/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -81,15 +81,15 @@ test_expect_success 'git clean src/ src/' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean src/ src/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -98,16 +98,16 @@ test_expect_success 'git clean with prefix' '\n \tmkdir -p build docs src/test &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n \t(cd src/ && git clean) &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f src/test/1.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file src/test/1.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -163,16 +163,16 @@ test_expect_success 'git clean -d with prefix and path' '\n \tmkdir -p build docs src/feature &&\n \ttouch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&\n \t(cd src/ && git clean -d feature/) &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest ! -f src/feature/file.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_missing src/feature/file.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -182,16 +182,16 @@ test_expect_success SYMLINKS 'git clean symbolic link' '\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tln -s docs/manual.txt src/part4.c &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -f src/part4.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing src/part4.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -199,13 +199,13 @@ test_expect_success 'git clean with wildcard' '\n \n \ttouch a.clean b.clean other.c &&\n \tgit clean \"*.clean\" &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.clean &&\n-\ttest ! -f b.clean &&\n-\ttest -f other.c\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.clean &&\n+\ttest_path_is_missing b.clean &&\n+\ttest_path_is_file other.c\n \n '\n \n@@ -214,15 +214,15 @@ test_expect_success 'git clean -n' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -n &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -231,15 +231,15 @@ test_expect_success 'git clean -d' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -248,16 +248,16 @@ test_expect_success 'git clean -d src/ examples/' '\n \tmkdir -p build docs examples &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&\n \tgit clean -d src/ examples/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -f examples/1.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing examples/1.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -266,15 +266,15 @@ test_expect_success 'git clean -x' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -x &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -283,15 +283,15 @@ test_expect_success 'git clean -d -x' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -x &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -300,15 +300,15 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -x -e src &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -317,15 +317,15 @@ test_expect_success 'git clean -X' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -X &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -334,15 +334,15 @@ test_expect_success 'git clean -d -X' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -X &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -351,15 +351,15 @@ test_expect_success 'git clean -d -X with ignored tracked directory' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -X -e src &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -382,29 +382,29 @@ test_expect_success 'clean.requireForce and -n' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -n &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n test_expect_success 'clean.requireForce and -f' '\n \n \tgit clean -f &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -453,11 +453,11 @@ test_expect_success 'nested git work tree' '\n \t\ttest_commit deeply.nested deeper.world\n \t) &&\n \tgit clean -f -d &&\n-\ttest -f foo/.git/index &&\n-\ttest -f foo/hello.world &&\n-\ttest -f baz/boo/.git/index &&\n-\ttest -f baz/boo/deeper.world &&\n-\t! test -d bar\n+\ttest_path_is_file foo/.git/index &&\n+\ttest_path_is_file foo/hello.world &&\n+\ttest_path_is_file baz/boo/.git/index &&\n+\ttest_path_is_file baz/boo/deeper.world &&\n+\ttest_path_is_missing bar\n '\n \n test_expect_success 'should clean things that almost look like git but are not' '\n@@ -624,9 +624,9 @@ test_expect_success 'force removal of nested git work tree' '\n \t\ttest_commit deeply.nested deeper.world\n \t) &&\n \tgit clean -f -f -d &&\n-\t! test -d foo &&\n-\t! test -d bar &&\n-\t! test -d baz\n+\ttest_path_is_missing foo &&\n+\ttest_path_is_missing bar &&\n+\ttest_path_is_missing baz\n '\n \n test_expect_success 'git clean -e' '\n@@ -638,10 +638,10 @@ test_expect_success 'git clean -e' '\n \t\ttouch known 1 2 3 &&\n \t\tgit add known &&\n \t\tgit clean -f -e 1 -e 2 &&\n-\t\ttest -e 1 &&\n-\t\ttest -e 2 &&\n-\t\t! (test -e 3) &&\n-\t\ttest -e known\n+\t\ttest_path_exists 1 &&\n+\t\ttest_path_exists 2 &&\n+\t\ttest_path_is_missing 3 &&\n+\t\ttest_path_exists known\n \t)\n '\n \n@@ -649,7 +649,7 @@ test_expect_success SANITY 'git clean -d with an unreadable empty directory' '\n \tmkdir foo &&\n \tchmod a= foo &&\n \tgit clean -dfx foo &&\n-\t! test -d foo\n+\ttest_path_is_missing foo\n '\n \n test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' '\n\nbase-commit: 90fe3800b92a49173530828c0a17951abd30f0e1\n-- \ngitgitgadget\n"},{"id":"504464","messageId":"xmqqo73u1n0k.fsf@gitster.g","threadId":"62273","inReplyTo":"CADYq+fYZSGBTnO+dM+MtHj=oUMqDWt+6wu-wEzwfWQJkSomkWA@mail.gmail.com","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-10-08T18:13:15Z","receivedAt":"2024-10-08T18:13:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Samuel Abraham <abrahamadekunle50@gmail.com> writes:\n\n> ...\n>  This was the reason for replacing \"test ! -[df]\" with\n> \"test_path_is_missing\" where I think is appropriate.\n\nTelling that concisely in the proposed log message will help those\nwho are reviewing the patch and those who are reading \"git log -p\"\nlater, and that is what I would want to see after a review exchange\nlike this.\n\nThanks.\n"},{"id":"504511","messageId":"CADYq+fb9ux6K+m-8y0owopt_zKJmXXYLh6Rswot3r7UNX30LAQ@mail.gmail.com","threadId":"62273","inReplyTo":"xmqqo73u1n0k.fsf@gitster.g","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Samuel Abraham","fromEmail":"abrahamadekunle50@gmail.com","sentAt":"2024-10-09T03:35:04Z","receivedAt":"2024-10-09T03:35:15Z","isPatch":true,"sender":{"key":"abrahamadekunle50@gmail.com","avatar":"https://avatars.githubusercontent.com/u/110066922?v=4"},"body":"On Tue, Oct 8, 2024 at 7:13 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Samuel Abraham <abrahamadekunle50@gmail.com> writes:\n>\n> > ...\n> >  This was the reason for replacing \"test ! -[df]\" with\n> > \"test_path_is_missing\" where I think is appropriate.\n>\n> Telling that concisely in the proposed log message will help those\n> who are reviewing the patch and those who are reading \"git log -p\"\n> later, and that is what I would want to see after a review exchange\n> like this.\n>\n> Thanks.\nHi, Junio\nI want to express my gratitude to you and every member for your time,\n guidance and patience and to my Outreachy mentors Patrick and Phillip.\nIt has been a great learning experience.  I can see the patch has been\nintegrated into seen.\nI look forward to working on #leftoverbits projects to enhance my understanding\nof the git codebase. Thank you very much once again.\n"},{"id":"504524","messageId":"ZwYux_Nb9GwqPuuk@pks.im","threadId":"62273","inReplyTo":"CADYq+fb9ux6K+m-8y0owopt_zKJmXXYLh6Rswot3r7UNX30LAQ@mail.gmail.com","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-10-09T07:20:45Z","receivedAt":"2024-10-09T07:20:51Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Oct 09, 2024 at 04:35:04AM +0100, Samuel Abraham wrote:\n> On Tue, Oct 8, 2024 at 7:13 PM Junio C Hamano <gitster@pobox.com> wrote:\n> >\n> > Samuel Abraham <abrahamadekunle50@gmail.com> writes:\n> >\n> > > ...\n> > >  This was the reason for replacing \"test ! -[df]\" with\n> > > \"test_path_is_missing\" where I think is appropriate.\n> >\n> > Telling that concisely in the proposed log message will help those\n> > who are reviewing the patch and those who are reading \"git log -p\"\n> > later, and that is what I would want to see after a review exchange\n> > like this.\n> >\n> > Thanks.\n> Hi, Junio\n> I want to express my gratitude to you and every member for your time,\n>  guidance and patience and to my Outreachy mentors Patrick and Phillip.\n> It has been a great learning experience.  I can see the patch has been\n> integrated into seen.\n> I look forward to working on #leftoverbits projects to enhance my understanding\n> of the git codebase. Thank you very much once again.\n\nNote that a patch that has been merged into \"seen\" does not yet say that\nit will be part of the next release. \"seen\" is only an integration\nbranch for topics which are currently in-flight on the mailing list and\nin the process of being reviewed. The intent is that we can catch any\nincompatibilities between two different in-flight patch series early.\n\nSo declaring victory is a bit too early :) A better indicator is that\nthe patch has been merged to \"next\". This is described in\nDocumentation/MyFirstContribution.txt, section \"After Review Approval\",\nand more in-depth in Documentation/howto/maintain-git.txt.\n\nI think that your v2 isn't quite there yet. As Junio mentions, he'd like\nto see an updated commit message that includes your explanations why you\nhave done certain conversions the way you did. The fact that some parts\nof the patch required discussion to arrive at a common understanding is\na good telling factor that a summarized form of the discussion should\nlikely be part of the commit message such that future readers of the\npatch will get the same context.\n\nPatrick\n"},{"id":"504597","messageId":"CADYq+faN2zFS712tPcfjBE5OjmPVei6Q+ZvcAHU94nag59ZpEA@mail.gmail.com","threadId":"62273","inReplyTo":"ZwYux_Nb9GwqPuuk@pks.im","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Samuel Abraham","fromEmail":"abrahamadekunle50@gmail.com","sentAt":"2024-10-09T15:41:47Z","receivedAt":"2024-10-09T15:41:59Z","isPatch":true,"sender":{"key":"abrahamadekunle50@gmail.com","avatar":"https://avatars.githubusercontent.com/u/110066922?v=4"},"body":"On Wed, Oct 9, 2024 at 8:20 AM Patrick Steinhardt <ps@pks.im> wrote:\n>\n> On Wed, Oct 09, 2024 at 04:35:04AM +0100, Samuel Abraham wrote:\n> > On Tue, Oct 8, 2024 at 7:13 PM Junio C Hamano <gitster@pobox.com> wrote:\n> > >\n> > > Samuel Abraham <abrahamadekunle50@gmail.com> writes:\n> > >\n> > > > ...\n> > > >  This was the reason for replacing \"test ! -[df]\" with\n> > > > \"test_path_is_missing\" where I think is appropriate.\n> > >\n> > > Telling that concisely in the proposed log message will help those\n> > > who are reviewing the patch and those who are reading \"git log -p\"\n> > > later, and that is what I would want to see after a review exchange\n> > > like this.\n> > >\n> > > Thanks.\n> > Hi, Junio\n> > I want to express my gratitude to you and every member for your time,\n> >  guidance and patience and to my Outreachy mentors Patrick and Phillip.\n> > It has been a great learning experience.  I can see the patch has been\n> > integrated into seen.\n> > I look forward to working on #leftoverbits projects to enhance my understanding\n> > of the git codebase. Thank you very much once again.\n>\n> Note that a patch that has been merged into \"seen\" does not yet say that\n> it will be part of the next release. \"seen\" is only an integration\n> branch for topics which are currently in-flight on the mailing list and\n> in the process of being reviewed. The intent is that we can catch any\n> incompatibilities between two different in-flight patch series early.\n>\n> So declaring victory is a bit too early :) A better indicator is that\n> the patch has been merged to \"next\". This is described in\n> Documentation/MyFirstContribution.txt, section \"After Review Approval\",\n> and more in-depth in Documentation/howto/maintain-git.txt.\n>\n> I think that your v2 isn't quite there yet. As Junio mentions, he'd like\n> to see an updated commit message that includes your explanations why you\n> have done certain conversions the way you did. The fact that some parts\n> of the patch required discussion to arrive at a common understanding is\n> a good telling factor that a summarized form of the discussion should\n> likely be part of the commit message such that future readers of the\n> patch will get the same context.\n>\n> Patrick\n\nHello Patrick,\nThank you very much for the clarification. Yes I was almost\ncelebrating already :).\nI will write a detailed commit message and send an updated patch.\nThanks.\n"},{"id":"504605","messageId":"pull.1811.v3.git.1728493350545.gitgitgadget@gmail.com","threadId":"62273","inReplyTo":"pull.1811.v2.git.1728390135644.gitgitgadget@gmail.com","subject":"[PATCH v3] t7300-clean.sh: use test_path_* helper functions for error logging","fromName":"Samuel Adekunle Abraham via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-10-09T17:02:30Z","receivedAt":"2024-10-09T17:02:35Z","isPatch":true,"sender":{"key":"name:Samuel Adekunle Abraham","avatar":null},"body":"From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n\nThis test script uses \"test - [def]\", but when a test fails because\nthe file passed to it does not exist,\nit fails silently without an error message.\nUse test_path_* helper functions, which are designed to give better\nerror messages when their expectations are not met.\n\nI have added a mechanical validation that applies the same transformation\ndone in this patch, when the test script is passed to a sed script as shown\nbelow.\n\nsed -e 's/^\\(\t*\\)test -f /\\1test_path_is_file /' \\\n    -e 's/^\\(\t*\\)test -d /\\1test_path_is_dir /' \\\n    -e 's/^\\(\t*\\)test -e /\\1test_path_exists /' \\\n    -e 's/^\\(\t*\\)! test -[edf] /\\1test_path_is_missing /' \\\n    -e 's/^\\(\t*\\)test ! -[edf] /\\1test_path_is_missing /' \\\n       \"$1\" >foo.sh\n\nReviewers can use the sed script to tranform the original test script and\ncompare the result in foo.sh with the results of applying the patch.\nYou will see an instance of \"!(test -e 3)\" which was manually replaced with\n\"\"test_path_is_missing 3\", and everything else should match.\n\nCareful and deliberate observation was done to check instances where\n\"test ! - [df] foo\" was used in the test script to make sure that the test\ninstances were expecting foo to EITHER be a file or a directory, and NOT a\npossibility of being both as this would make replacing \"test ! -f foo\" with\n\"test_path_is_missing foo\" unreasonable.\nIn the tests control flow, foo has been created as EITHER a\nreguar file OR a directory and should NOT exist\nafter \"git clean\" or \"git clean -d\", as the case maybe, has been called.\nThis made it reasonable to replace\n\"test ! -[df] foo\" with \"test_path_is_missing foo\".\nExamples for each case is shown below\n\ntest_expect_success 'git clean with prefix' '\n\tmkdir -p build docs src/test &&\n\ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n\t(cd src/ && git clean) &&\n\ttest -f Makefile &&\n\ttest -f README &&\n\ttest -f src/part1.c &&\n\ttest -f src/part2.c &&\n\ttest -f a.out &&\n\ttest ! -f src/part3.c &&\n\ntest_expect_success 'git clean -d -x with ignored tracked directory' '\n\tmkdir -p build docs &&\n\ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n\tgit clean -d -X -e src &&\n\ttest -f Makefile &&\n\ttest -f README &&\n\ttest -f src/part1.c &&\n\ttest -f src/part2.c &&\n\ttest -f a.out &&\n\ttest ! -f src/part3.c &&\n\ttest -f docs/manual.txt &&\n\ttest ! -f obj.o &&\n\nand\n\ntest_expect_success 'git clean -d -x with ignored tracked directory' '\n\tmkdir -p build docs &&\n\ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n\tgit clean -d -x -e src &&\n\ttest -f Makefile &&\n\ttest -f README &&\n\ttest -f src/part1.c &&\n\ttest -f src/part2.c &&\n\ttest ! -f a.out &&\n\ttest -f src/part3.c &&\n\ttest ! -d docs &&\n\ttest ! -f obj.o &&\n\ttest ! -d build\n\nand\n\ntest_expect_success 'should clean things that almost look like git ...'\n\ttest_expect_success 'force removal of nested git work tree' '\n\t\ttest_commit deeply.nested deeper.world\n\t\t) &&\n\tgit clean -f -f -d &&\n\t! test -d foo &&\n\t! test -d bar &&\n\t! test -d baz\n\nSigned-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n---\n    [Outreachy][PATCH] t7300-clean.sh: use test_path_* helper functions for\n    error logging\n    \n    This test script uses \"test - [def]\", but when a test fails because the\n    file passed to it does not exist, it fails silently without an error\n    message.\n    \n    Use test_path_* helper functions, which are designed to give better\n    error messages when their expectations are not met.\n    \n    I have added a mechanical validation that applies the same\n    transformation done in this patch, when the script is passed to a sed\n    script as shown below\n    \n    #!/bin/bash\n    sed -e 's/^\\(\t*\\)test -f /\\1test_path_is_file /' \\\n        -e 's/^\\(\t*\\)test -d /\\1test_path_is_dir /' \\\n        -e 's/^\\(\t*\\)test -e /\\1test_path_exists /' \\\n        -e 's/^\\(\t*\\)! test -[edf] /\\1test_path_is_missing /' \\\n        -e 's/^\\(\t*\\)test ! -[edf] /\\1test_path_is_missing /' \\\n           \"$1\" >foo.sh\n    \n    \n    Reviewers can use the sed script to transform the original test script\n    and compare the results in foo.sh with the results of applying this\n    patch You will see an instance of \"! (test -e 3)\" which was manually\n    replaced with \"test_path_is_missing\", and everything else should match.\n    I have carefully studied the instances where \"test ! - [df] foo\" were\n    used in the script to make sure that the test instances were expecting a\n    file or a directory to not exist as the case may be before replacing\n    with \"test_path_is_missing\".\n    \n    Signed-off-by: Abraham Samuel Adekunle abrahamadekunle50@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1811%2Fdevdekunle%2Fupdate_tests-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1811/devdekunle/update_tests-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/1811\n\nRange-diff vs v2:\n\n 1:  62d57156dcf ! 1:  ca008b23a25 t7300-clean.sh: use test_path_* helper functions for error logging\n     @@ Commit message\n          Use test_path_* helper functions, which are designed to give better\n          error messages when their expectations are not met.\n      \n     +    I have added a mechanical validation that applies the same transformation\n     +    done in this patch, when the test script is passed to a sed script as shown\n     +    below.\n     +\n     +    sed -e 's/^\\(   *\\)test -f /\\1test_path_is_file /' \\\n     +        -e 's/^\\(   *\\)test -d /\\1test_path_is_dir /' \\\n     +        -e 's/^\\(   *\\)test -e /\\1test_path_exists /' \\\n     +        -e 's/^\\(   *\\)! test -[edf] /\\1test_path_is_missing /' \\\n     +        -e 's/^\\(   *\\)test ! -[edf] /\\1test_path_is_missing /' \\\n     +           \"$1\" >foo.sh\n     +\n     +    Reviewers can use the sed script to tranform the original test script and\n     +    compare the result in foo.sh with the results of applying the patch.\n     +    You will see an instance of \"!(test -e 3)\" which was manually replaced with\n     +    \"\"test_path_is_missing 3\", and everything else should match.\n     +\n     +    Careful and deliberate observation was done to check instances where\n     +    \"test ! - [df] foo\" was used in the test script to make sure that the test\n     +    instances were expecting foo to EITHER be a file or a directory, and NOT a\n     +    possibility of being both as this would make replacing \"test ! -f foo\" with\n     +    \"test_path_is_missing foo\" unreasonable.\n     +    In the tests control flow, foo has been created as EITHER a\n     +    reguar file OR a directory and should NOT exist\n     +    after \"git clean\" or \"git clean -d\", as the case maybe, has been called.\n     +    This made it reasonable to replace\n     +    \"test ! -[df] foo\" with \"test_path_is_missing foo\".\n     +    Examples for each case is shown below\n     +\n     +    test_expect_success 'git clean with prefix' '\n     +            mkdir -p build docs src/test &&\n     +            touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n     +            (cd src/ && git clean) &&\n     +            test -f Makefile &&\n     +            test -f README &&\n     +            test -f src/part1.c &&\n     +            test -f src/part2.c &&\n     +            test -f a.out &&\n     +            test ! -f src/part3.c &&\n     +\n     +    test_expect_success 'git clean -d -x with ignored tracked directory' '\n     +            mkdir -p build docs &&\n     +            touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n     +            git clean -d -X -e src &&\n     +            test -f Makefile &&\n     +            test -f README &&\n     +            test -f src/part1.c &&\n     +            test -f src/part2.c &&\n     +            test -f a.out &&\n     +            test ! -f src/part3.c &&\n     +            test -f docs/manual.txt &&\n     +            test ! -f obj.o &&\n     +\n     +    and\n     +\n     +    test_expect_success 'git clean -d -x with ignored tracked directory' '\n     +            mkdir -p build docs &&\n     +            touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n     +            git clean -d -x -e src &&\n     +            test -f Makefile &&\n     +            test -f README &&\n     +            test -f src/part1.c &&\n     +            test -f src/part2.c &&\n     +            test ! -f a.out &&\n     +            test -f src/part3.c &&\n     +            test ! -d docs &&\n     +            test ! -f obj.o &&\n     +            test ! -d build\n     +\n     +    and\n     +\n     +    test_expect_success 'should clean things that almost look like git ...'\n     +            test_expect_success 'force removal of nested git work tree' '\n     +                    test_commit deeply.nested deeper.world\n     +                    ) &&\n     +            git clean -f -f -d &&\n     +            ! test -d foo &&\n     +            ! test -d bar &&\n     +            ! test -d baz\n     +\n          Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n      \n       ## t/t7300-clean.sh ##\n\n\n t/t7300-clean.sh | 370 +++++++++++++++++++++++------------------------\n 1 file changed, 185 insertions(+), 185 deletions(-)\n\ndiff --git a/t/t7300-clean.sh b/t/t7300-clean.sh\nindex 0aae0dee670..5c97eb0dfe9 100755\n--- a/t/t7300-clean.sh\n+++ b/t/t7300-clean.sh\n@@ -29,15 +29,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so &&\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so &&\n \tgit update-index --no-skip-worktree .gitignore &&\n \tgit checkout .gitignore\n '\n@@ -47,15 +47,15 @@ test_expect_success 'git clean' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -64,15 +64,15 @@ test_expect_success 'git clean src/' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean src/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -81,15 +81,15 @@ test_expect_success 'git clean src/ src/' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean src/ src/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -98,16 +98,16 @@ test_expect_success 'git clean with prefix' '\n \tmkdir -p build docs src/test &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n \t(cd src/ && git clean) &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f src/test/1.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file src/test/1.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -163,16 +163,16 @@ test_expect_success 'git clean -d with prefix and path' '\n \tmkdir -p build docs src/feature &&\n \ttouch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&\n \t(cd src/ && git clean -d feature/) &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest ! -f src/feature/file.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_missing src/feature/file.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -182,16 +182,16 @@ test_expect_success SYMLINKS 'git clean symbolic link' '\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tln -s docs/manual.txt src/part4.c &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -f src/part4.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing src/part4.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -199,13 +199,13 @@ test_expect_success 'git clean with wildcard' '\n \n \ttouch a.clean b.clean other.c &&\n \tgit clean \"*.clean\" &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.clean &&\n-\ttest ! -f b.clean &&\n-\ttest -f other.c\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.clean &&\n+\ttest_path_is_missing b.clean &&\n+\ttest_path_is_file other.c\n \n '\n \n@@ -214,15 +214,15 @@ test_expect_success 'git clean -n' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -n &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -231,15 +231,15 @@ test_expect_success 'git clean -d' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -248,16 +248,16 @@ test_expect_success 'git clean -d src/ examples/' '\n \tmkdir -p build docs examples &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&\n \tgit clean -d src/ examples/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -f examples/1.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing examples/1.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -266,15 +266,15 @@ test_expect_success 'git clean -x' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -x &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -283,15 +283,15 @@ test_expect_success 'git clean -d -x' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -x &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -300,15 +300,15 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -x -e src &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -317,15 +317,15 @@ test_expect_success 'git clean -X' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -X &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -334,15 +334,15 @@ test_expect_success 'git clean -d -X' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -X &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -351,15 +351,15 @@ test_expect_success 'git clean -d -X with ignored tracked directory' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -X -e src &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -382,29 +382,29 @@ test_expect_success 'clean.requireForce and -n' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -n &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n test_expect_success 'clean.requireForce and -f' '\n \n \tgit clean -f &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -453,11 +453,11 @@ test_expect_success 'nested git work tree' '\n \t\ttest_commit deeply.nested deeper.world\n \t) &&\n \tgit clean -f -d &&\n-\ttest -f foo/.git/index &&\n-\ttest -f foo/hello.world &&\n-\ttest -f baz/boo/.git/index &&\n-\ttest -f baz/boo/deeper.world &&\n-\t! test -d bar\n+\ttest_path_is_file foo/.git/index &&\n+\ttest_path_is_file foo/hello.world &&\n+\ttest_path_is_file baz/boo/.git/index &&\n+\ttest_path_is_file baz/boo/deeper.world &&\n+\ttest_path_is_missing bar\n '\n \n test_expect_success 'should clean things that almost look like git but are not' '\n@@ -624,9 +624,9 @@ test_expect_success 'force removal of nested git work tree' '\n \t\ttest_commit deeply.nested deeper.world\n \t) &&\n \tgit clean -f -f -d &&\n-\t! test -d foo &&\n-\t! test -d bar &&\n-\t! test -d baz\n+\ttest_path_is_missing foo &&\n+\ttest_path_is_missing bar &&\n+\ttest_path_is_missing baz\n '\n \n test_expect_success 'git clean -e' '\n@@ -638,10 +638,10 @@ test_expect_success 'git clean -e' '\n \t\ttouch known 1 2 3 &&\n \t\tgit add known &&\n \t\tgit clean -f -e 1 -e 2 &&\n-\t\ttest -e 1 &&\n-\t\ttest -e 2 &&\n-\t\t! (test -e 3) &&\n-\t\ttest -e known\n+\t\ttest_path_exists 1 &&\n+\t\ttest_path_exists 2 &&\n+\t\ttest_path_is_missing 3 &&\n+\t\ttest_path_exists known\n \t)\n '\n \n@@ -649,7 +649,7 @@ test_expect_success SANITY 'git clean -d with an unreadable empty directory' '\n \tmkdir foo &&\n \tchmod a= foo &&\n \tgit clean -dfx foo &&\n-\t! test -d foo\n+\ttest_path_is_missing foo\n '\n \n test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' '\n\nbase-commit: 90fe3800b92a49173530828c0a17951abd30f0e1\n-- \ngitgitgadget\n"},{"id":"504611","messageId":"xmqqmsjduqrs.fsf@gitster.g","threadId":"62273","inReplyTo":"ZwYux_Nb9GwqPuuk@pks.im","subject":"Re: [PATCH] t7300-clean.sh: use test_path_* helper functions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-10-09T17:31:35Z","receivedAt":"2024-10-09T17:31:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> I think that your v2 isn't quite there yet. As Junio mentions, he'd like\n> to see an updated commit message that includes your explanations why you\n> have done certain conversions the way you did. The fact that some parts\n> of the patch required discussion to arrive at a common understanding is\n> a good telling factor that a summarized form of the discussion should\n> likely be part of the commit message such that future readers of the\n> patch will get the same context.\n\nWhat v2 had after the three-dash line seemed to me an OK material\nfor a proposed commit log message, but it should have been before\nthe line.  I suspect that it was from typical GGG gotcha?\n\nThanks.\n"},{"id":"504616","messageId":"xmqqzfndtbgv.fsf@gitster.g","threadId":"62273","inReplyTo":"pull.1811.v3.git.1728493350545.gitgitgadget@gmail.com","subject":"Re: [PATCH v3] t7300-clean.sh: use test_path_* helper functions for error logging","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-10-09T17:47:28Z","receivedAt":"2024-10-09T17:47:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Samuel Adekunle Abraham via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n>\n> This test script uses \"test - [def]\", but when a test fails because\n> the file passed to it does not exist,\n> it fails silently without an error message.\n> Use test_path_* helper functions, which are designed to give better\n> error messages when their expectations are not met.\n>\n> I have added a mechanical validation that applies the same transformation\n> done in this patch, when the test script is passed to a sed script as shown\n> below.\n>\n> sed -e 's/^\\(\t*\\)test -f /\\1test_path_is_file /' \\\n>     -e 's/^\\(\t*\\)test -d /\\1test_path_is_dir /' \\\n>     -e 's/^\\(\t*\\)test -e /\\1test_path_exists /' \\\n>     -e 's/^\\(\t*\\)! test -[edf] /\\1test_path_is_missing /' \\\n>     -e 's/^\\(\t*\\)test ! -[edf] /\\1test_path_is_missing /' \\\n>        \"$1\" >foo.sh\n>\n> Reviewers can use the sed script to tranform the original test script and\n> compare the result in foo.sh with the results of applying the patch.\n> You will see an instance of \"!(test -e 3)\" which was manually replaced with\n> \"\"test_path_is_missing 3\", and everything else should match.\n>\n> Careful and deliberate observation was done to check instances where\n> \"test ! - [df] foo\" was used in the test script to make sure that the test\n> instances were expecting foo to EITHER be a file or a directory, and NOT a\n> possibility of being both as this would make replacing \"test ! -f foo\" with\n> \"test_path_is_missing foo\" unreasonable.\n> In the tests control flow, foo has been created as EITHER a\n> reguar file OR a directory and should NOT exist\n> after \"git clean\" or \"git clean -d\", as the case maybe, has been called.\n> This made it reasonable to replace\n> \"test ! -[df] foo\" with \"test_path_is_missing foo\".\n\nThis is a good place to stop (but perhaps have a paragraph break\nbefore \"In the tests control\").  The \"examples\" you have below is\nlike telling readers to go read the patch and verify the correctness\nof it themselves, which is not adding much value.\n\nOther than that, looking very good.\n\nThanks.\n\n\n>  t/t7300-clean.sh | 370 +++++++++++++++++++++++------------------------\n>  1 file changed, 185 insertions(+), 185 deletions(-)\n>\n> diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh\n> index 0aae0dee670..5c97eb0dfe9 100755\n> --- a/t/t7300-clean.sh\n> +++ b/t/t7300-clean.sh\n> @@ -29,15 +29,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so &&\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so &&\n>  \tgit update-index --no-skip-worktree .gitignore &&\n>  \tgit checkout .gitignore\n>  '\n> @@ -47,15 +47,15 @@ test_expect_success 'git clean' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -64,15 +64,15 @@ test_expect_success 'git clean src/' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean src/ &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -81,15 +81,15 @@ test_expect_success 'git clean src/ src/' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean src/ src/ &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -98,16 +98,16 @@ test_expect_success 'git clean with prefix' '\n>  \tmkdir -p build docs src/test &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n>  \t(cd src/ && git clean) &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest -f src/test/1.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_file src/test/1.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -163,16 +163,16 @@ test_expect_success 'git clean -d with prefix and path' '\n>  \tmkdir -p build docs src/feature &&\n>  \ttouch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&\n>  \t(cd src/ && git clean -d feature/) &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest -f src/part3.c &&\n> -\ttest ! -f src/feature/file.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_file src/part3.c &&\n> +\ttest_path_is_missing src/feature/file.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -182,16 +182,16 @@ test_expect_success SYMLINKS 'git clean symbolic link' '\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tln -s docs/manual.txt src/part4.c &&\n>  \tgit clean &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest ! -f src/part4.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_missing src/part4.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -199,13 +199,13 @@ test_expect_success 'git clean with wildcard' '\n>  \n>  \ttouch a.clean b.clean other.c &&\n>  \tgit clean \"*.clean\" &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.clean &&\n> -\ttest ! -f b.clean &&\n> -\ttest -f other.c\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.clean &&\n> +\ttest_path_is_missing b.clean &&\n> +\ttest_path_is_file other.c\n>  \n>  '\n>  \n> @@ -214,15 +214,15 @@ test_expect_success 'git clean -n' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -n &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_file src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -231,15 +231,15 @@ test_expect_success 'git clean -d' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -d &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest ! -d docs &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_missing docs &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -248,16 +248,16 @@ test_expect_success 'git clean -d src/ examples/' '\n>  \tmkdir -p build docs examples &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&\n>  \tgit clean -d src/ examples/ &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest ! -f examples/1.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_missing examples/1.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -266,15 +266,15 @@ test_expect_success 'git clean -x' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -x &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest ! -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_missing obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -283,15 +283,15 @@ test_expect_success 'git clean -d -x' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -d -x &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest ! -d docs &&\n> -\ttest ! -f obj.o &&\n> -\ttest ! -d build\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_missing docs &&\n> +\ttest_path_is_missing obj.o &&\n> +\ttest_path_is_missing build\n>  \n>  '\n>  \n> @@ -300,15 +300,15 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -d -x -e src &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.out &&\n> -\ttest -f src/part3.c &&\n> -\ttest ! -d docs &&\n> -\ttest ! -f obj.o &&\n> -\ttest ! -d build\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.out &&\n> +\ttest_path_is_file src/part3.c &&\n> +\ttest_path_is_missing docs &&\n> +\ttest_path_is_missing obj.o &&\n> +\ttest_path_is_missing build\n>  \n>  '\n>  \n> @@ -317,15 +317,15 @@ test_expect_success 'git clean -X' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -X &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest ! -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_file src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_missing obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -334,15 +334,15 @@ test_expect_success 'git clean -d -X' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -d -X &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest ! -f obj.o &&\n> -\ttest ! -d build\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_file src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_missing obj.o &&\n> +\ttest_path_is_missing build\n>  \n>  '\n>  \n> @@ -351,15 +351,15 @@ test_expect_success 'git clean -d -X with ignored tracked directory' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -d -X -e src &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest ! -f obj.o &&\n> -\ttest ! -d build\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_missing obj.o &&\n> +\ttest_path_is_missing build\n>  \n>  '\n>  \n> @@ -382,29 +382,29 @@ test_expect_success 'clean.requireForce and -n' '\n>  \tmkdir -p build docs &&\n>  \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n>  \tgit clean -n &&\n> -\ttest -f Makefile &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest -f a.out &&\n> -\ttest -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file Makefile &&\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_file a.out &&\n> +\ttest_path_is_file src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n>  test_expect_success 'clean.requireForce and -f' '\n>  \n>  \tgit clean -f &&\n> -\ttest -f README &&\n> -\ttest -f src/part1.c &&\n> -\ttest -f src/part2.c &&\n> -\ttest ! -f a.out &&\n> -\ttest ! -f src/part3.c &&\n> -\ttest -f docs/manual.txt &&\n> -\ttest -f obj.o &&\n> -\ttest -f build/lib.so\n> +\ttest_path_is_file README &&\n> +\ttest_path_is_file src/part1.c &&\n> +\ttest_path_is_file src/part2.c &&\n> +\ttest_path_is_missing a.out &&\n> +\ttest_path_is_missing src/part3.c &&\n> +\ttest_path_is_file docs/manual.txt &&\n> +\ttest_path_is_file obj.o &&\n> +\ttest_path_is_file build/lib.so\n>  \n>  '\n>  \n> @@ -453,11 +453,11 @@ test_expect_success 'nested git work tree' '\n>  \t\ttest_commit deeply.nested deeper.world\n>  \t) &&\n>  \tgit clean -f -d &&\n> -\ttest -f foo/.git/index &&\n> -\ttest -f foo/hello.world &&\n> -\ttest -f baz/boo/.git/index &&\n> -\ttest -f baz/boo/deeper.world &&\n> -\t! test -d bar\n> +\ttest_path_is_file foo/.git/index &&\n> +\ttest_path_is_file foo/hello.world &&\n> +\ttest_path_is_file baz/boo/.git/index &&\n> +\ttest_path_is_file baz/boo/deeper.world &&\n> +\ttest_path_is_missing bar\n>  '\n>  \n>  test_expect_success 'should clean things that almost look like git but are not' '\n> @@ -624,9 +624,9 @@ test_expect_success 'force removal of nested git work tree' '\n>  \t\ttest_commit deeply.nested deeper.world\n>  \t) &&\n>  \tgit clean -f -f -d &&\n> -\t! test -d foo &&\n> -\t! test -d bar &&\n> -\t! test -d baz\n> +\ttest_path_is_missing foo &&\n> +\ttest_path_is_missing bar &&\n> +\ttest_path_is_missing baz\n>  '\n>  \n>  test_expect_success 'git clean -e' '\n> @@ -638,10 +638,10 @@ test_expect_success 'git clean -e' '\n>  \t\ttouch known 1 2 3 &&\n>  \t\tgit add known &&\n>  \t\tgit clean -f -e 1 -e 2 &&\n> -\t\ttest -e 1 &&\n> -\t\ttest -e 2 &&\n> -\t\t! (test -e 3) &&\n> -\t\ttest -e known\n> +\t\ttest_path_exists 1 &&\n> +\t\ttest_path_exists 2 &&\n> +\t\ttest_path_is_missing 3 &&\n> +\t\ttest_path_exists known\n>  \t)\n>  '\n>  \n> @@ -649,7 +649,7 @@ test_expect_success SANITY 'git clean -d with an unreadable empty directory' '\n>  \tmkdir foo &&\n>  \tchmod a= foo &&\n>  \tgit clean -dfx foo &&\n> -\t! test -d foo\n> +\ttest_path_is_missing foo\n>  '\n>  \n>  test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' '\n>\n> base-commit: 90fe3800b92a49173530828c0a17951abd30f0e1\n"},{"id":"504621","messageId":"pull.1811.v4.git.1728498122419.gitgitgadget@gmail.com","threadId":"62273","inReplyTo":"pull.1811.v3.git.1728493350545.gitgitgadget@gmail.com","subject":"[PATCH v4] t7300-clean.sh: use test_path_* helper functions for error logging","fromName":"Samuel Adekunle Abraham via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-10-09T18:22:02Z","receivedAt":"2024-10-09T18:22:05Z","isPatch":true,"sender":{"key":"name:Samuel Adekunle Abraham","avatar":null},"body":"From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n\nThis test script uses \"test - [def]\", but when a test fails because\nthe file passed to it does not exist,\nit fails silently without an error message.\nUse test_path_* helper functions, which are designed to give better\nerror messages when their expectations are not met.\n\nI have added a mechanical validation that applies the same transformation\ndone in this patch, when the test script is passed to a sed script as shown\nbelow.\n\nsed -e 's/^\\(\t*\\)test -f /\\1test_path_is_file /' \\\n    -e 's/^\\(\t*\\)test -d /\\1test_path_is_dir /' \\\n    -e 's/^\\(\t*\\)test -e /\\1test_path_exists /' \\\n    -e 's/^\\(\t*\\)! test -[edf] /\\1test_path_is_missing /' \\\n    -e 's/^\\(\t*\\)test ! -[edf] /\\1test_path_is_missing /' \\\n       \"$1\" >foo.sh\n\nReviewers can use the sed script to tranform the original test script and\ncompare the result in foo.sh with the results of applying the patch.\nYou will see an instance of \"!(test -e 3)\" which was manually replaced with\n\"\"test_path_is_missing 3\", and everything else should match.\n\nCareful and deliberate observation was done to check instances where\n\"test ! - [df] foo\" was used in the test script to make sure that the test\ninstances were expecting foo to EITHER be a file or a directory, and NOT a\npossibility of being both as this would make replacing \"test ! -f foo\" with\n\"test_path_is_missing foo\" unreasonable.\n\nIn the tests control flow, foo has been created as EITHER a\nreguar file OR a directory and should NOT exist\nafter \"git clean\" or \"git clean -d\", as the case maybe, has been called.\nThis made it reasonable to replace\n\"test ! -[df] foo\" with \"test_path_is_missing foo\".\n\nSigned-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n---\n    [Outreachy][PATCH] t7300-clean.sh: use test_path_* helper functions for\n    error logging\n    \n    This test script uses \"test - [def]\", but when a test fails because the\n    file passed to it does not exist, it fails silently without an error\n    message.\n    \n    Use test_path_* helper functions, which are designed to give better\n    error messages when their expectations are not met.\n    \n    I have added a mechanical validation that applies the same\n    transformation done in this patch, when the script is passed to a sed\n    script as shown below\n    \n    #!/bin/bash\n    sed -e 's/^\\(\t*\\)test -f /\\1test_path_is_file /' \\\n        -e 's/^\\(\t*\\)test -d /\\1test_path_is_dir /' \\\n        -e 's/^\\(\t*\\)test -e /\\1test_path_exists /' \\\n        -e 's/^\\(\t*\\)! test -[edf] /\\1test_path_is_missing /' \\\n        -e 's/^\\(\t*\\)test ! -[edf] /\\1test_path_is_missing /' \\\n           \"$1\" >foo.sh\n    \n    \n    Reviewers can use the sed script to transform the original test script\n    and compare the results in foo.sh with the results of applying this\n    patch You will see an instance of \"! (test -e 3)\" which was manually\n    replaced with \"test_path_is_missing\", and everything else should match.\n    I have carefully studied the instances where \"test ! - [df] foo\" were\n    used in the script to make sure that the test instances were expecting a\n    file or a directory to not exist as the case may be before replacing\n    with \"test_path_is_missing\".\n    \n    Signed-off-by: Abraham Samuel Adekunle abrahamadekunle50@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1811%2Fdevdekunle%2Fupdate_tests-v4\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1811/devdekunle/update_tests-v4\nPull-Request: https://github.com/gitgitgadget/git/pull/1811\n\nRange-diff vs v3:\n\n 1:  ca008b23a25 ! 1:  ad61cbe75ac t7300-clean.sh: use test_path_* helper functions for error logging\n     @@ Commit message\n          instances were expecting foo to EITHER be a file or a directory, and NOT a\n          possibility of being both as this would make replacing \"test ! -f foo\" with\n          \"test_path_is_missing foo\" unreasonable.\n     +\n          In the tests control flow, foo has been created as EITHER a\n          reguar file OR a directory and should NOT exist\n          after \"git clean\" or \"git clean -d\", as the case maybe, has been called.\n          This made it reasonable to replace\n          \"test ! -[df] foo\" with \"test_path_is_missing foo\".\n     -    Examples for each case is shown below\n     -\n     -    test_expect_success 'git clean with prefix' '\n     -            mkdir -p build docs src/test &&\n     -            touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n     -            (cd src/ && git clean) &&\n     -            test -f Makefile &&\n     -            test -f README &&\n     -            test -f src/part1.c &&\n     -            test -f src/part2.c &&\n     -            test -f a.out &&\n     -            test ! -f src/part3.c &&\n     -\n     -    test_expect_success 'git clean -d -x with ignored tracked directory' '\n     -            mkdir -p build docs &&\n     -            touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n     -            git clean -d -X -e src &&\n     -            test -f Makefile &&\n     -            test -f README &&\n     -            test -f src/part1.c &&\n     -            test -f src/part2.c &&\n     -            test -f a.out &&\n     -            test ! -f src/part3.c &&\n     -            test -f docs/manual.txt &&\n     -            test ! -f obj.o &&\n     -\n     -    and\n     -\n     -    test_expect_success 'git clean -d -x with ignored tracked directory' '\n     -            mkdir -p build docs &&\n     -            touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n     -            git clean -d -x -e src &&\n     -            test -f Makefile &&\n     -            test -f README &&\n     -            test -f src/part1.c &&\n     -            test -f src/part2.c &&\n     -            test ! -f a.out &&\n     -            test -f src/part3.c &&\n     -            test ! -d docs &&\n     -            test ! -f obj.o &&\n     -            test ! -d build\n     -\n     -    and\n     -\n     -    test_expect_success 'should clean things that almost look like git ...'\n     -            test_expect_success 'force removal of nested git work tree' '\n     -                    test_commit deeply.nested deeper.world\n     -                    ) &&\n     -            git clean -f -f -d &&\n     -            ! test -d foo &&\n     -            ! test -d bar &&\n     -            ! test -d baz\n      \n          Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n      \n\n\n t/t7300-clean.sh | 370 +++++++++++++++++++++++------------------------\n 1 file changed, 185 insertions(+), 185 deletions(-)\n\ndiff --git a/t/t7300-clean.sh b/t/t7300-clean.sh\nindex 0aae0dee670..5c97eb0dfe9 100755\n--- a/t/t7300-clean.sh\n+++ b/t/t7300-clean.sh\n@@ -29,15 +29,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so &&\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so &&\n \tgit update-index --no-skip-worktree .gitignore &&\n \tgit checkout .gitignore\n '\n@@ -47,15 +47,15 @@ test_expect_success 'git clean' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -64,15 +64,15 @@ test_expect_success 'git clean src/' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean src/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -81,15 +81,15 @@ test_expect_success 'git clean src/ src/' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean src/ src/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -98,16 +98,16 @@ test_expect_success 'git clean with prefix' '\n \tmkdir -p build docs src/test &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n \t(cd src/ && git clean) &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f src/test/1.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file src/test/1.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -163,16 +163,16 @@ test_expect_success 'git clean -d with prefix and path' '\n \tmkdir -p build docs src/feature &&\n \ttouch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&\n \t(cd src/ && git clean -d feature/) &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest ! -f src/feature/file.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_missing src/feature/file.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -182,16 +182,16 @@ test_expect_success SYMLINKS 'git clean symbolic link' '\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tln -s docs/manual.txt src/part4.c &&\n \tgit clean &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -f src/part4.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing src/part4.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -199,13 +199,13 @@ test_expect_success 'git clean with wildcard' '\n \n \ttouch a.clean b.clean other.c &&\n \tgit clean \"*.clean\" &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.clean &&\n-\ttest ! -f b.clean &&\n-\ttest -f other.c\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.clean &&\n+\ttest_path_is_missing b.clean &&\n+\ttest_path_is_file other.c\n \n '\n \n@@ -214,15 +214,15 @@ test_expect_success 'git clean -n' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -n &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -231,15 +231,15 @@ test_expect_success 'git clean -d' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -248,16 +248,16 @@ test_expect_success 'git clean -d src/ examples/' '\n \tmkdir -p build docs examples &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&\n \tgit clean -d src/ examples/ &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -f examples/1.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing examples/1.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -266,15 +266,15 @@ test_expect_success 'git clean -x' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -x &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -283,15 +283,15 @@ test_expect_success 'git clean -d -x' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -x &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -300,15 +300,15 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -x -e src &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest ! -d docs &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_missing docs &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -317,15 +317,15 @@ test_expect_success 'git clean -X' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -X &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -334,15 +334,15 @@ test_expect_success 'git clean -d -X' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -X &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -351,15 +351,15 @@ test_expect_success 'git clean -d -X with ignored tracked directory' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -d -X -e src &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest ! -f obj.o &&\n-\ttest ! -d build\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_missing obj.o &&\n+\ttest_path_is_missing build\n \n '\n \n@@ -382,29 +382,29 @@ test_expect_success 'clean.requireForce and -n' '\n \tmkdir -p build docs &&\n \ttouch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n \tgit clean -n &&\n-\ttest -f Makefile &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest -f a.out &&\n-\ttest -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file Makefile &&\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_file a.out &&\n+\ttest_path_is_file src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n test_expect_success 'clean.requireForce and -f' '\n \n \tgit clean -f &&\n-\ttest -f README &&\n-\ttest -f src/part1.c &&\n-\ttest -f src/part2.c &&\n-\ttest ! -f a.out &&\n-\ttest ! -f src/part3.c &&\n-\ttest -f docs/manual.txt &&\n-\ttest -f obj.o &&\n-\ttest -f build/lib.so\n+\ttest_path_is_file README &&\n+\ttest_path_is_file src/part1.c &&\n+\ttest_path_is_file src/part2.c &&\n+\ttest_path_is_missing a.out &&\n+\ttest_path_is_missing src/part3.c &&\n+\ttest_path_is_file docs/manual.txt &&\n+\ttest_path_is_file obj.o &&\n+\ttest_path_is_file build/lib.so\n \n '\n \n@@ -453,11 +453,11 @@ test_expect_success 'nested git work tree' '\n \t\ttest_commit deeply.nested deeper.world\n \t) &&\n \tgit clean -f -d &&\n-\ttest -f foo/.git/index &&\n-\ttest -f foo/hello.world &&\n-\ttest -f baz/boo/.git/index &&\n-\ttest -f baz/boo/deeper.world &&\n-\t! test -d bar\n+\ttest_path_is_file foo/.git/index &&\n+\ttest_path_is_file foo/hello.world &&\n+\ttest_path_is_file baz/boo/.git/index &&\n+\ttest_path_is_file baz/boo/deeper.world &&\n+\ttest_path_is_missing bar\n '\n \n test_expect_success 'should clean things that almost look like git but are not' '\n@@ -624,9 +624,9 @@ test_expect_success 'force removal of nested git work tree' '\n \t\ttest_commit deeply.nested deeper.world\n \t) &&\n \tgit clean -f -f -d &&\n-\t! test -d foo &&\n-\t! test -d bar &&\n-\t! test -d baz\n+\ttest_path_is_missing foo &&\n+\ttest_path_is_missing bar &&\n+\ttest_path_is_missing baz\n '\n \n test_expect_success 'git clean -e' '\n@@ -638,10 +638,10 @@ test_expect_success 'git clean -e' '\n \t\ttouch known 1 2 3 &&\n \t\tgit add known &&\n \t\tgit clean -f -e 1 -e 2 &&\n-\t\ttest -e 1 &&\n-\t\ttest -e 2 &&\n-\t\t! (test -e 3) &&\n-\t\ttest -e known\n+\t\ttest_path_exists 1 &&\n+\t\ttest_path_exists 2 &&\n+\t\ttest_path_is_missing 3 &&\n+\t\ttest_path_exists known\n \t)\n '\n \n@@ -649,7 +649,7 @@ test_expect_success SANITY 'git clean -d with an unreadable empty directory' '\n \tmkdir foo &&\n \tchmod a= foo &&\n \tgit clean -dfx foo &&\n-\t! test -d foo\n+\ttest_path_is_missing foo\n '\n \n test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' '\n\nbase-commit: 90fe3800b92a49173530828c0a17951abd30f0e1\n-- \ngitgitgadget\n"},{"id":"504622","messageId":"CADYq+fbgKNc-=0sqNA=wNWSF9PA653Eo-SzkBPB_6fU8BW53-g@mail.gmail.com","threadId":"62273","inReplyTo":"xmqqzfndtbgv.fsf@gitster.g","subject":"Re: [PATCH v3] t7300-clean.sh: use test_path_* helper functions for error logging","fromName":"Samuel Abraham","fromEmail":"abrahamadekunle50@gmail.com","sentAt":"2024-10-09T18:24:43Z","receivedAt":"2024-10-09T18:24:55Z","isPatch":true,"sender":{"key":"abrahamadekunle50@gmail.com","avatar":"https://avatars.githubusercontent.com/u/110066922?v=4"},"body":"On Wed, Oct 9, 2024 at 6:47 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Samuel Adekunle Abraham via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n>\n> > From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>\n> >\n> > This test script uses \"test - [def]\", but when a test fails because\n> > the file passed to it does not exist,\n> > it fails silently without an error message.\n> > Use test_path_* helper functions, which are designed to give better\n> > error messages when their expectations are not met.\n> >\n> > I have added a mechanical validation that applies the same transformation\n> > done in this patch, when the test script is passed to a sed script as shown\n> > below.\n> >\n> > sed -e 's/^\\( *\\)test -f /\\1test_path_is_file /' \\\n> >     -e 's/^\\( *\\)test -d /\\1test_path_is_dir /' \\\n> >     -e 's/^\\( *\\)test -e /\\1test_path_exists /' \\\n> >     -e 's/^\\( *\\)! test -[edf] /\\1test_path_is_missing /' \\\n> >     -e 's/^\\( *\\)test ! -[edf] /\\1test_path_is_missing /' \\\n> >        \"$1\" >foo.sh\n> >\n> > Reviewers can use the sed script to tranform the original test script and\n> > compare the result in foo.sh with the results of applying the patch.\n> > You will see an instance of \"!(test -e 3)\" which was manually replaced with\n> > \"\"test_path_is_missing 3\", and everything else should match.\n> >\n> > Careful and deliberate observation was done to check instances where\n> > \"test ! - [df] foo\" was used in the test script to make sure that the test\n> > instances were expecting foo to EITHER be a file or a directory, and NOT a\n> > possibility of being both as this would make replacing \"test ! -f foo\" with\n> > \"test_path_is_missing foo\" unreasonable.\n> > In the tests control flow, foo has been created as EITHER a\n> > reguar file OR a directory and should NOT exist\n> > after \"git clean\" or \"git clean -d\", as the case maybe, has been called.\n> > This made it reasonable to replace\n> > \"test ! -[df] foo\" with \"test_path_is_missing foo\".\n>\n> This is a good place to stop (but perhaps have a paragraph break\n> before \"In the tests control\").  The \"examples\" you have below is\n> like telling readers to go read the patch and verify the correctness\n> of it themselves, which is not adding much value.\n>\n> Other than that, looking very good.\n>\n> Thanks.\n\nThank you very much, I have submitted an updated patch.\n>\n> >  t/t7300-clean.sh | 370 +++++++++++++++++++++++------------------------\n> >  1 file changed, 185 insertions(+), 185 deletions(-)\n> >\n> > diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh\n> > index 0aae0dee670..5c97eb0dfe9 100755\n> > --- a/t/t7300-clean.sh\n> > +++ b/t/t7300-clean.sh\n> > @@ -29,15 +29,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so &&\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so &&\n> >       git update-index --no-skip-worktree .gitignore &&\n> >       git checkout .gitignore\n> >  '\n> > @@ -47,15 +47,15 @@ test_expect_success 'git clean' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -64,15 +64,15 @@ test_expect_success 'git clean src/' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean src/ &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -81,15 +81,15 @@ test_expect_success 'git clean src/ src/' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean src/ src/ &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -98,16 +98,16 @@ test_expect_success 'git clean with prefix' '\n> >       mkdir -p build docs src/test &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&\n> >       (cd src/ && git clean) &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test -f src/test/1.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_file src/test/1.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -163,16 +163,16 @@ test_expect_success 'git clean -d with prefix and path' '\n> >       mkdir -p build docs src/feature &&\n> >       touch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&\n> >       (cd src/ && git clean -d feature/) &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test -f src/part3.c &&\n> > -     test ! -f src/feature/file.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_file src/part3.c &&\n> > +     test_path_is_missing src/feature/file.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -182,16 +182,16 @@ test_expect_success SYMLINKS 'git clean symbolic link' '\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       ln -s docs/manual.txt src/part4.c &&\n> >       git clean &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test ! -f src/part4.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_missing src/part4.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -199,13 +199,13 @@ test_expect_success 'git clean with wildcard' '\n> >\n> >       touch a.clean b.clean other.c &&\n> >       git clean \"*.clean\" &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.clean &&\n> > -     test ! -f b.clean &&\n> > -     test -f other.c\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.clean &&\n> > +     test_path_is_missing b.clean &&\n> > +     test_path_is_file other.c\n> >\n> >  '\n> >\n> > @@ -214,15 +214,15 @@ test_expect_success 'git clean -n' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -n &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_file src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -231,15 +231,15 @@ test_expect_success 'git clean -d' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -d &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test ! -d docs &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_missing docs &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -248,16 +248,16 @@ test_expect_success 'git clean -d src/ examples/' '\n> >       mkdir -p build docs examples &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&\n> >       git clean -d src/ examples/ &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test ! -f examples/1.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_missing examples/1.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -266,15 +266,15 @@ test_expect_success 'git clean -x' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -x &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test ! -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_missing obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -283,15 +283,15 @@ test_expect_success 'git clean -d -x' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -d -x &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test ! -d docs &&\n> > -     test ! -f obj.o &&\n> > -     test ! -d build\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_missing docs &&\n> > +     test_path_is_missing obj.o &&\n> > +     test_path_is_missing build\n> >\n> >  '\n> >\n> > @@ -300,15 +300,15 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -d -x -e src &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.out &&\n> > -     test -f src/part3.c &&\n> > -     test ! -d docs &&\n> > -     test ! -f obj.o &&\n> > -     test ! -d build\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.out &&\n> > +     test_path_is_file src/part3.c &&\n> > +     test_path_is_missing docs &&\n> > +     test_path_is_missing obj.o &&\n> > +     test_path_is_missing build\n> >\n> >  '\n> >\n> > @@ -317,15 +317,15 @@ test_expect_success 'git clean -X' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -X &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test ! -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_file src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_missing obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -334,15 +334,15 @@ test_expect_success 'git clean -d -X' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -d -X &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test ! -f obj.o &&\n> > -     test ! -d build\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_file src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_missing obj.o &&\n> > +     test_path_is_missing build\n> >\n> >  '\n> >\n> > @@ -351,15 +351,15 @@ test_expect_success 'git clean -d -X with ignored tracked directory' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -d -X -e src &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test ! -f obj.o &&\n> > -     test ! -d build\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_missing obj.o &&\n> > +     test_path_is_missing build\n> >\n> >  '\n> >\n> > @@ -382,29 +382,29 @@ test_expect_success 'clean.requireForce and -n' '\n> >       mkdir -p build docs &&\n> >       touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&\n> >       git clean -n &&\n> > -     test -f Makefile &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test -f a.out &&\n> > -     test -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file Makefile &&\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_file a.out &&\n> > +     test_path_is_file src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> >  test_expect_success 'clean.requireForce and -f' '\n> >\n> >       git clean -f &&\n> > -     test -f README &&\n> > -     test -f src/part1.c &&\n> > -     test -f src/part2.c &&\n> > -     test ! -f a.out &&\n> > -     test ! -f src/part3.c &&\n> > -     test -f docs/manual.txt &&\n> > -     test -f obj.o &&\n> > -     test -f build/lib.so\n> > +     test_path_is_file README &&\n> > +     test_path_is_file src/part1.c &&\n> > +     test_path_is_file src/part2.c &&\n> > +     test_path_is_missing a.out &&\n> > +     test_path_is_missing src/part3.c &&\n> > +     test_path_is_file docs/manual.txt &&\n> > +     test_path_is_file obj.o &&\n> > +     test_path_is_file build/lib.so\n> >\n> >  '\n> >\n> > @@ -453,11 +453,11 @@ test_expect_success 'nested git work tree' '\n> >               test_commit deeply.nested deeper.world\n> >       ) &&\n> >       git clean -f -d &&\n> > -     test -f foo/.git/index &&\n> > -     test -f foo/hello.world &&\n> > -     test -f baz/boo/.git/index &&\n> > -     test -f baz/boo/deeper.world &&\n> > -     ! test -d bar\n> > +     test_path_is_file foo/.git/index &&\n> > +     test_path_is_file foo/hello.world &&\n> > +     test_path_is_file baz/boo/.git/index &&\n> > +     test_path_is_file baz/boo/deeper.world &&\n> > +     test_path_is_missing bar\n> >  '\n> >\n> >  test_expect_success 'should clean things that almost look like git but are not' '\n> > @@ -624,9 +624,9 @@ test_expect_success 'force removal of nested git work tree' '\n> >               test_commit deeply.nested deeper.world\n> >       ) &&\n> >       git clean -f -f -d &&\n> > -     ! test -d foo &&\n> > -     ! test -d bar &&\n> > -     ! test -d baz\n> > +     test_path_is_missing foo &&\n> > +     test_path_is_missing bar &&\n> > +     test_path_is_missing baz\n> >  '\n> >\n> >  test_expect_success 'git clean -e' '\n> > @@ -638,10 +638,10 @@ test_expect_success 'git clean -e' '\n> >               touch known 1 2 3 &&\n> >               git add known &&\n> >               git clean -f -e 1 -e 2 &&\n> > -             test -e 1 &&\n> > -             test -e 2 &&\n> > -             ! (test -e 3) &&\n> > -             test -e known\n> > +             test_path_exists 1 &&\n> > +             test_path_exists 2 &&\n> > +             test_path_is_missing 3 &&\n> > +             test_path_exists known\n> >       )\n> >  '\n> >\n> > @@ -649,7 +649,7 @@ test_expect_success SANITY 'git clean -d with an unreadable empty directory' '\n> >       mkdir foo &&\n> >       chmod a= foo &&\n> >       git clean -dfx foo &&\n> > -     ! test -d foo\n> > +     test_path_is_missing foo\n> >  '\n> >\n> >  test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' '\n> >\n> > base-commit: 90fe3800b92a49173530828c0a17951abd30f0e1\n"}]}