* [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts @ 2024-02-19 17:22 Vincenzo Mezzela 2024-02-19 17:22 ` [GSOC][RFC PATCH 1/1] t: t7301-clean-interactive: Use test_path_is_(missing|file) Vincenzo Mezzela ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Vincenzo Mezzela @ 2024-02-19 17:22 UTC (permalink / raw) To: git; +Cc: Vincenzo Mezzela This patch is submitted as a microproject for the application to the GSOC. Upon previous dicussion[1], this patch replace the test shell commands with the helper functions as follows: - 'test -f' --> 'test_path_is_file' - 'test ! -f' --> 'test_path_is_missing' In the context of this file, 'test ! -f' is meant to check if the file has been correctly cleaned, thus its usage has been replaced with 'test_path_is_missing' instead of '! test_path_is_file'. Submitting as RFC to ask whether there is room for further improvements: Would you like to see something like ''' test_path_is_missing file1 && test_path_is_file file2 && test_path_is_missing file3 && test_path_is_file file5 ''' changed into ''' test_path_is_file file2 && test_path_is_file file5 && test_path_is_missing file3 && test_path_is_missing file1 ''' where all the test_path_is_file are grouped before and followed by all the test_path_is_missing (or the other way around) to enhance readability of the code? Thanks, Vincenzo [1] https://lore.kernel.org/git/xmqqy1bo5k5h.fsf@gitster.g/ Vincenzo Mezzela (1): t: t7301-clean-interactive: Use test_path_is_(missing|file) t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ 1 file changed, 245 insertions(+), 245 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [GSOC][RFC PATCH 1/1] t: t7301-clean-interactive: Use test_path_is_(missing|file) 2024-02-19 17:22 [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela @ 2024-02-19 17:22 ` Vincenzo Mezzela 2024-02-26 10:13 ` Christian Couder 2024-02-19 19:36 ` [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts Eric Sunshine 2024-02-27 16:17 ` [GSOC][PATCH v2 " Vincenzo Mezzela 2 siblings, 1 reply; 14+ messages in thread From: Vincenzo Mezzela @ 2024-02-19 17:22 UTC (permalink / raw) To: git; +Cc: Vincenzo Mezzela Replace test -(f|e) with the appropriate helper functions provided by test-lib-functions.sh Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@gmail.com> --- t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ 1 file changed, 245 insertions(+), 245 deletions(-) diff --git a/t/t7301-clean-interactive.sh b/t/t7301-clean-interactive.sh index d82a3210a1..4afe53c66a 100755 --- a/t/t7301-clean-interactive.sh +++ b/t/t7301-clean-interactive.sh @@ -25,18 +25,18 @@ test_expect_success 'git clean -i (c: clean hotkey)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo c | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -46,18 +46,18 @@ test_expect_success 'git clean -i (cl: clean prefix)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo cl | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -67,18 +67,18 @@ test_expect_success 'git clean -i (quit)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo quit | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -88,18 +88,18 @@ test_expect_success 'git clean -i (Ctrl+D)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo "\04" | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -110,18 +110,18 @@ test_expect_success 'git clean -id (filter all)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "*" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -132,18 +132,18 @@ test_expect_success 'git clean -id (filter patterns)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "part3.* *.out" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -154,18 +154,18 @@ test_expect_success 'git clean -id (filter patterns 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "* !*.out" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -176,18 +176,18 @@ test_expect_success 'git clean -id (select - all)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "*" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -198,18 +198,18 @@ test_expect_success 'git clean -id (select - none)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -220,18 +220,18 @@ test_expect_success 'git clean -id (select - number)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s 3 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -242,18 +242,18 @@ test_expect_success 'git clean -id (select - number 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "2 3" 5 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -264,18 +264,18 @@ test_expect_success 'git clean -id (select - number 3)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "3,4 5" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -285,11 +285,11 @@ test_expect_success 'git clean -id (select - filenames)' ' touch a.out foo.txt bar.txt baz.txt && test_write_lines s "a.out fo ba bar" "" c | git clean -id && - test -f Makefile && - test ! -f a.out && - test ! -f foo.txt && - test ! -f bar.txt && - test -f baz.txt && + test_path_is_file Makefile && + test_path_is_missing a.out && + test_path_is_missing foo.txt && + test_path_is_missing bar.txt && + test_path_is_file baz.txt && rm baz.txt ' @@ -301,18 +301,18 @@ test_expect_success 'git clean -id (select - range)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "1,3-4" 2 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test ! -f docs/manual.txt && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_missing docs/manual.txt && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -323,18 +323,18 @@ test_expect_success 'git clean -id (select - range 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "4- 1" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -345,18 +345,18 @@ test_expect_success 'git clean -id (inverse select)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "*" "-5- 1 -2" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -367,18 +367,18 @@ test_expect_success 'git clean -id (ask)' ' docs/manual.txt obj.o build/lib.so && test_write_lines a Y y no yes bad "" | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -389,18 +389,18 @@ test_expect_success 'git clean -id (ask - Ctrl+D)' ' docs/manual.txt obj.o build/lib.so && test_write_lines a Y no yes "\04" | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -412,18 +412,18 @@ test_expect_success 'git clean -id with prefix and path (filter)' ' (cd build/ && test_write_lines f docs "*.h" "" c | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -435,18 +435,18 @@ test_expect_success 'git clean -id with prefix and path (select by name)' ' (cd build/ && test_write_lines s ../docs/ ../src/part3.c ../src/part4.c "" c | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -458,18 +458,18 @@ test_expect_success 'git clean -id with prefix and path (ask)' ' (cd build/ && test_write_lines a Y y no yes bad "" | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' -- 2.34.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [GSOC][RFC PATCH 1/1] t: t7301-clean-interactive: Use test_path_is_(missing|file) 2024-02-19 17:22 ` [GSOC][RFC PATCH 1/1] t: t7301-clean-interactive: Use test_path_is_(missing|file) Vincenzo Mezzela @ 2024-02-26 10:13 ` Christian Couder 0 siblings, 0 replies; 14+ messages in thread From: Christian Couder @ 2024-02-26 10:13 UTC (permalink / raw) To: Vincenzo Mezzela; +Cc: git About the subject, instead of "t: t7301-clean-interactive: Use ...", something like "t7301-clean-interactive: use ..." or "t7301: use ..." would be better. First because there is no need for both "t:" and "t7301-clean-interactive:" for the "area" part of the subject. Only one "area" part is enough. Second because the first word after the "area" part should not be capitalized. See: https://git-scm.com/docs/SubmittingPatches/#summary-section On Mon, Feb 19, 2024 at 6:22 PM Vincenzo Mezzela <vincenzo.mezzela@gmail.com> wrote: > > Replace test -(f|e) with the appropriate helper functions provided by > test-lib-functions.sh I think your commit message should explain why it's better to use test_path_is_(missing|file) instead of test -(f|e). Also replacing `test ! -f` with `test_path_is_missing` might be wrong if it's Ok to have a directory instead of a file (in which case the latter would fail while the former would work). So a few words about why it's Ok to do it here would be nice. Thanks! ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts 2024-02-19 17:22 [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 2024-02-19 17:22 ` [GSOC][RFC PATCH 1/1] t: t7301-clean-interactive: Use test_path_is_(missing|file) Vincenzo Mezzela @ 2024-02-19 19:36 ` Eric Sunshine 2024-02-27 16:17 ` [GSOC][PATCH v2 " Vincenzo Mezzela 2 siblings, 0 replies; 14+ messages in thread From: Eric Sunshine @ 2024-02-19 19:36 UTC (permalink / raw) To: Vincenzo Mezzela; +Cc: git On Mon, Feb 19, 2024 at 12:22 PM Vincenzo Mezzela <vincenzo.mezzela@gmail.com> wrote: > Would you like to see something like > ''' > test_path_is_missing file1 && > test_path_is_file file2 && > test_path_is_missing file3 && > test_path_is_file file5 > ''' > changed into > ''' > test_path_is_file file2 && > test_path_is_file file5 && > test_path_is_missing file3 && > test_path_is_missing file1 > ''' > where all the test_path_is_file are grouped before and followed by all > the test_path_is_missing (or the other way around) to enhance > readability of the code? Generally speaking, no, reviewers would not want to see such a change because "enhanced readability" is often quite subjective. More importantly, though, reviewers would especially not want this done in the same patch which changes `test -blah` to `test_path_foo` because it make it harder for the reviewer to associate and verify each `test -blah` to `test_path_foo` replacement in the final result with the source statement in the original file. It's much easier for a reviewer to validate old against new when there is an obvious one-to-one correspondence. ^ permalink raw reply [flat|nested] 14+ messages in thread
* [GSOC][PATCH v2 0/1] microproject: use test_path_is_* functions in test scripts 2024-02-19 17:22 [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 2024-02-19 17:22 ` [GSOC][RFC PATCH 1/1] t: t7301-clean-interactive: Use test_path_is_(missing|file) Vincenzo Mezzela 2024-02-19 19:36 ` [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts Eric Sunshine @ 2024-02-27 16:17 ` Vincenzo Mezzela 2024-02-27 16:17 ` [GSOC][PATCH v2 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela 2024-03-04 17:17 ` [GSOC][PATCH v3 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 2 siblings, 2 replies; 14+ messages in thread From: Vincenzo Mezzela @ 2024-02-27 16:17 UTC (permalink / raw) To: git; +Cc: Vincenzo Mezzela Hi, Following previous discussions[1][2], this patch is submitted as a microproject for the application to the GSOC. Thanks, Vincenzo Changes in V2: * Fixed commit message[2]. [1] https://lore.kernel.org/git/xmqqy1bo5k5h.fsf@gitster.g/ [2] https://lore.kernel.org/git/20240219172214.7644-1-vincenzo.mezzela@gmail.com/ Vincenzo Mezzela (1): t: t7301-clean-interactive: Use test_path_is_(missing|file) t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ 1 file changed, 245 insertions(+), 245 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [GSOC][PATCH v2 1/1] t7301: use test_path_is_(missing|file) 2024-02-27 16:17 ` [GSOC][PATCH v2 " Vincenzo Mezzela @ 2024-02-27 16:17 ` Vincenzo Mezzela 2024-03-04 9:31 ` Patrick Steinhardt 2024-03-04 17:17 ` [GSOC][PATCH v3 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 1 sibling, 1 reply; 14+ messages in thread From: Vincenzo Mezzela @ 2024-02-27 16:17 UTC (permalink / raw) To: git; +Cc: Vincenzo Mezzela Refactor test -(f|e) to utilize the corresponding helper functions from test-lib-functions.sh. These functions perform indentical operations while enhancing debugging capabilities in case of test failures. In the context of this file, 'test ! -f' is meant to check if the file has been correctly cleaned, thus its usage is replaced with 'test_path_is_missing' instead of '! test_path_is_file'. Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@gmail.com> --- t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ 1 file changed, 245 insertions(+), 245 deletions() diff --git a/t/t7301-clean-interactive.sh b/t/t7301-clean-interactive.sh index d82a3210a1..4afe53c66a 100755 --- a/t/t7301-clean-interactive.sh +++ b/t/t7301-clean-interactive.sh @@ -25,18 +25,18 @@ test_expect_success 'git clean -i (c: clean hotkey)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo c | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -46,18 +46,18 @@ test_expect_success 'git clean -i (cl: clean prefix)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo cl | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -67,18 +67,18 @@ test_expect_success 'git clean -i (quit)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo quit | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -88,18 +88,18 @@ test_expect_success 'git clean -i (Ctrl+D)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo "\04" | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -110,18 +110,18 @@ test_expect_success 'git clean -id (filter all)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "*" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -132,18 +132,18 @@ test_expect_success 'git clean -id (filter patterns)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "part3.* *.out" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -154,18 +154,18 @@ test_expect_success 'git clean -id (filter patterns 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "* !*.out" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -176,18 +176,18 @@ test_expect_success 'git clean -id (select - all)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "*" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -198,18 +198,18 @@ test_expect_success 'git clean -id (select - none)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -220,18 +220,18 @@ test_expect_success 'git clean -id (select - number)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s 3 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -242,18 +242,18 @@ test_expect_success 'git clean -id (select - number 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "2 3" 5 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -264,18 +264,18 @@ test_expect_success 'git clean -id (select - number 3)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "3,4 5" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -285,11 +285,11 @@ test_expect_success 'git clean -id (select - filenames)' ' touch a.out foo.txt bar.txt baz.txt && test_write_lines s "a.out fo ba bar" "" c | git clean -id && - test -f Makefile && - test ! -f a.out && - test ! -f foo.txt && - test ! -f bar.txt && - test -f baz.txt && + test_path_is_file Makefile && + test_path_is_missing a.out && + test_path_is_missing foo.txt && + test_path_is_missing bar.txt && + test_path_is_file baz.txt && rm baz.txt ' @@ -301,18 +301,18 @@ test_expect_success 'git clean -id (select - range)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "1,3-4" 2 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test ! -f docs/manual.txt && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_missing docs/manual.txt && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -323,18 +323,18 @@ test_expect_success 'git clean -id (select - range 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "4- 1" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -345,18 +345,18 @@ test_expect_success 'git clean -id (inverse select)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "*" "-5- 1 -2" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -367,18 +367,18 @@ test_expect_success 'git clean -id (ask)' ' docs/manual.txt obj.o build/lib.so && test_write_lines a Y y no yes bad "" | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -389,18 +389,18 @@ test_expect_success 'git clean -id (ask - Ctrl+D)' ' docs/manual.txt obj.o build/lib.so && test_write_lines a Y no yes "\04" | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -412,18 +412,18 @@ test_expect_success 'git clean -id with prefix and path (filter)' ' (cd build/ && test_write_lines f docs "*.h" "" c | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -435,18 +435,18 @@ test_expect_success 'git clean -id with prefix and path (select by name)' ' (cd build/ && test_write_lines s ../docs/ ../src/part3.c ../src/part4.c "" c | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -458,18 +458,18 @@ test_expect_success 'git clean -id with prefix and path (ask)' ' (cd build/ && test_write_lines a Y y no yes bad "" | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' -- 2.34.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [GSOC][PATCH v2 1/1] t7301: use test_path_is_(missing|file) 2024-02-27 16:17 ` [GSOC][PATCH v2 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela @ 2024-03-04 9:31 ` Patrick Steinhardt 0 siblings, 0 replies; 14+ messages in thread From: Patrick Steinhardt @ 2024-03-04 9:31 UTC (permalink / raw) To: Vincenzo Mezzela; +Cc: git [-- Attachment #1: Type: text/plain, Size: 21248 bytes --] On Tue, Feb 27, 2024 at 05:17:34PM +0100, Vincenzo Mezzela wrote: > Refactor test -(f|e) to utilize the corresponding helper functions from Nit: you didn't convert any instances of `test -e`, so I'd simplify the message to just say `test -f` here. > test-lib-functions.sh. These functions perform indentical operations > while enhancing debugging capabilities in case of test failures. > > In the context of this file, 'test ! -f' is meant to check if the file > has been correctly cleaned, thus its usage is replaced with > 'test_path_is_missing' instead of '! test_path_is_file'. > > Another nit: There should only be a single empty line between body and trailer lines. Other than that this patch looks good to me, thanks! Patrick > Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@gmail.com> > --- > t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ > 1 file changed, 245 insertions(+), 245 deletions() > > diff --git a/t/t7301-clean-interactive.sh b/t/t7301-clean-interactive.sh > index d82a3210a1..4afe53c66a 100755 > --- a/t/t7301-clean-interactive.sh > +++ b/t/t7301-clean-interactive.sh > @@ -25,18 +25,18 @@ test_expect_success 'git clean -i (c: clean hotkey)' ' > touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ > docs/manual.txt obj.o build/lib.so && > echo c | git clean -i && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test -f docs/manual.txt && > - test ! -f src/part3.c && > - test ! -f src/part3.h && > - test ! -f src/part4.c && > - test ! -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_missing src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -46,18 +46,18 @@ test_expect_success 'git clean -i (cl: clean prefix)' ' > touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ > docs/manual.txt obj.o build/lib.so && > echo cl | git clean -i && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test -f docs/manual.txt && > - test ! -f src/part3.c && > - test ! -f src/part3.h && > - test ! -f src/part4.c && > - test ! -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_missing src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -67,18 +67,18 @@ test_expect_success 'git clean -i (quit)' ' > touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ > docs/manual.txt obj.o build/lib.so && > echo quit | git clean -i && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test -f docs/manual.txt && > - test -f src/part3.c && > - test -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -88,18 +88,18 @@ test_expect_success 'git clean -i (Ctrl+D)' ' > touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ > docs/manual.txt obj.o build/lib.so && > echo "\04" | git clean -i && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test -f docs/manual.txt && > - test -f src/part3.c && > - test -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -110,18 +110,18 @@ test_expect_success 'git clean -id (filter all)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines f "*" "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test -f docs/manual.txt && > - test -f src/part3.c && > - test -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -132,18 +132,18 @@ test_expect_success 'git clean -id (filter patterns)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines f "part3.* *.out" "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test ! -f docs/manual.txt && > - test -f src/part3.c && > - test -f src/part3.h && > - test ! -f src/part4.c && > - test ! -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_missing docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_missing src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -154,18 +154,18 @@ test_expect_success 'git clean -id (filter patterns 2)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines f "* !*.out" "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test -f docs/manual.txt && > - test -f src/part3.c && > - test -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -176,18 +176,18 @@ test_expect_success 'git clean -id (select - all)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines s "*" "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test ! -f docs/manual.txt && > - test ! -f src/part3.c && > - test ! -f src/part3.h && > - test ! -f src/part4.c && > - test ! -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_missing docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_missing src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -198,18 +198,18 @@ test_expect_success 'git clean -id (select - none)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines s "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test -f docs/manual.txt && > - test -f src/part3.c && > - test -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -220,18 +220,18 @@ test_expect_success 'git clean -id (select - number)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines s 3 "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test -f docs/manual.txt && > - test ! -f src/part3.c && > - test -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -242,18 +242,18 @@ test_expect_success 'git clean -id (select - number 2)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines s "2 3" 5 "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test ! -f docs/manual.txt && > - test ! -f src/part3.c && > - test -f src/part3.h && > - test ! -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_missing docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -264,18 +264,18 @@ test_expect_success 'git clean -id (select - number 3)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines s "3,4 5" "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test -f docs/manual.txt && > - test ! -f src/part3.c && > - test ! -f src/part3.h && > - test ! -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -285,11 +285,11 @@ test_expect_success 'git clean -id (select - filenames)' ' > touch a.out foo.txt bar.txt baz.txt && > test_write_lines s "a.out fo ba bar" "" c | > git clean -id && > - test -f Makefile && > - test ! -f a.out && > - test ! -f foo.txt && > - test ! -f bar.txt && > - test -f baz.txt && > + test_path_is_file Makefile && > + test_path_is_missing a.out && > + test_path_is_missing foo.txt && > + test_path_is_missing bar.txt && > + test_path_is_file baz.txt && > rm baz.txt > > ' > @@ -301,18 +301,18 @@ test_expect_success 'git clean -id (select - range)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines s "1,3-4" 2 "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test ! -f src/part3.c && > - test ! -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test ! -f docs/manual.txt && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_missing src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_missing docs/manual.txt && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -323,18 +323,18 @@ test_expect_success 'git clean -id (select - range 2)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines s "4- 1" "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test -f docs/manual.txt && > - test -f src/part3.c && > - test ! -f src/part3.h && > - test ! -f src/part4.c && > - test ! -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_missing src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -345,18 +345,18 @@ test_expect_success 'git clean -id (inverse select)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines s "*" "-5- 1 -2" "" c | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test -f docs/manual.txt && > - test ! -f src/part3.c && > - test ! -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -367,18 +367,18 @@ test_expect_success 'git clean -id (ask)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines a Y y no yes bad "" | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test ! -f docs/manual.txt && > - test -f src/part3.c && > - test ! -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_missing docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -389,18 +389,18 @@ test_expect_success 'git clean -id (ask - Ctrl+D)' ' > docs/manual.txt obj.o build/lib.so && > test_write_lines a Y no yes "\04" | > git clean -id && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test -f docs/manual.txt && > - test ! -f src/part3.c && > - test -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -412,18 +412,18 @@ test_expect_success 'git clean -id with prefix and path (filter)' ' > (cd build/ && > test_write_lines f docs "*.h" "" c | > git clean -id ..) && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test -f docs/manual.txt && > - test ! -f src/part3.c && > - test -f src/part3.h && > - test ! -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_file docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -435,18 +435,18 @@ test_expect_success 'git clean -id with prefix and path (select by name)' ' > (cd build/ && > test_write_lines s ../docs/ ../src/part3.c ../src/part4.c "" c | > git clean -id ..) && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test -f a.out && > - test ! -f docs/manual.txt && > - test ! -f src/part3.c && > - test -f src/part3.h && > - test ! -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_file a.out && > + test_path_is_missing docs/manual.txt && > + test_path_is_missing src/part3.c && > + test_path_is_file src/part3.h && > + test_path_is_missing src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > @@ -458,18 +458,18 @@ test_expect_success 'git clean -id with prefix and path (ask)' ' > (cd build/ && > test_write_lines a Y y no yes bad "" | > git clean -id ..) && > - test -f Makefile && > - test -f README && > - test -f src/part1.c && > - test -f src/part2.c && > - test ! -f a.out && > - test ! -f docs/manual.txt && > - test -f src/part3.c && > - test ! -f src/part3.h && > - test -f src/part4.c && > - test -f src/part4.h && > - test -f obj.o && > - test -f build/lib.so > + test_path_is_file Makefile && > + test_path_is_file README && > + test_path_is_file src/part1.c && > + test_path_is_file src/part2.c && > + test_path_is_missing a.out && > + test_path_is_missing docs/manual.txt && > + test_path_is_file src/part3.c && > + test_path_is_missing src/part3.h && > + test_path_is_file src/part4.c && > + test_path_is_file src/part4.h && > + test_path_is_file obj.o && > + test_path_is_file build/lib.so > > ' > > -- > 2.34.1 > > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* [GSOC][PATCH v3 0/1] microproject: use test_path_is_* functions in test scripts 2024-02-27 16:17 ` [GSOC][PATCH v2 " Vincenzo Mezzela 2024-02-27 16:17 ` [GSOC][PATCH v2 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela @ 2024-03-04 17:17 ` Vincenzo Mezzela 2024-03-04 17:17 ` [GSOC][PATCH v3 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela 2024-03-10 11:43 ` [GSOC][PATCH v4 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 1 sibling, 2 replies; 14+ messages in thread From: Vincenzo Mezzela @ 2024-03-04 17:17 UTC (permalink / raw) To: git; +Cc: Vincenzo Mezzela Hi, Following previous discussions[1][2][3], this patch is submitted as a microproject for the application to the GSOC. Thanks, Vincenzo Changes in V2: * Fixed commit message[2]. Changes in V3: * Fixed commit message[3]. [1] https://lore.kernel.org/git/xmqqy1bo5k5h.fsf@gitster.g/ [2] https://lore.kernel.org/git/20240219172214.7644-1-vincenzo.mezzela@gmail.com/ [1] https://lore.kernel.org/git/ZeWVB5uKLONfp6cO@tanuki/ Vincenzo Mezzela (1): t7301: use test_path_is_(missing|file) t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ 1 file changed, 245 insertions(+), 245 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [GSOC][PATCH v3 1/1] t7301: use test_path_is_(missing|file) 2024-03-04 17:17 ` [GSOC][PATCH v3 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela @ 2024-03-04 17:17 ` Vincenzo Mezzela 2024-03-04 21:50 ` Junio C Hamano 2024-03-10 11:43 ` [GSOC][PATCH v4 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 1 sibling, 1 reply; 14+ messages in thread From: Vincenzo Mezzela @ 2024-03-04 17:17 UTC (permalink / raw) To: git; +Cc: Vincenzo Mezzela Refactor test -f to utilize the corresponding helper functions from test-lib-functions.sh. These functions perform identical operations while enhancing debugging capabilities in case of test failures. In the context of this file, 'test ! -f' is meant to check if the file has been correctly cleaned, thus its usage is replaced with 'test_path_is_missing' instead of '! test_path_is_file'. Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@gmail.com> --- t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ 1 file changed, 245 insertions(+), 245 deletions(-) diff --git a/t/t7301-clean-interactive.sh b/t/t7301-clean-interactive.sh index d82a3210a1..4afe53c66a 100755 --- a/t/t7301-clean-interactive.sh +++ b/t/t7301-clean-interactive.sh @@ -25,18 +25,18 @@ test_expect_success 'git clean -i (c: clean hotkey)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo c | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -46,18 +46,18 @@ test_expect_success 'git clean -i (cl: clean prefix)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo cl | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -67,18 +67,18 @@ test_expect_success 'git clean -i (quit)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo quit | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -88,18 +88,18 @@ test_expect_success 'git clean -i (Ctrl+D)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo "\04" | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -110,18 +110,18 @@ test_expect_success 'git clean -id (filter all)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "*" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -132,18 +132,18 @@ test_expect_success 'git clean -id (filter patterns)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "part3.* *.out" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -154,18 +154,18 @@ test_expect_success 'git clean -id (filter patterns 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "* !*.out" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -176,18 +176,18 @@ test_expect_success 'git clean -id (select - all)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "*" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -198,18 +198,18 @@ test_expect_success 'git clean -id (select - none)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -220,18 +220,18 @@ test_expect_success 'git clean -id (select - number)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s 3 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -242,18 +242,18 @@ test_expect_success 'git clean -id (select - number 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "2 3" 5 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -264,18 +264,18 @@ test_expect_success 'git clean -id (select - number 3)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "3,4 5" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -285,11 +285,11 @@ test_expect_success 'git clean -id (select - filenames)' ' touch a.out foo.txt bar.txt baz.txt && test_write_lines s "a.out fo ba bar" "" c | git clean -id && - test -f Makefile && - test ! -f a.out && - test ! -f foo.txt && - test ! -f bar.txt && - test -f baz.txt && + test_path_is_file Makefile && + test_path_is_missing a.out && + test_path_is_missing foo.txt && + test_path_is_missing bar.txt && + test_path_is_file baz.txt && rm baz.txt ' @@ -301,18 +301,18 @@ test_expect_success 'git clean -id (select - range)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "1,3-4" 2 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test ! -f docs/manual.txt && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_missing docs/manual.txt && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -323,18 +323,18 @@ test_expect_success 'git clean -id (select - range 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "4- 1" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -345,18 +345,18 @@ test_expect_success 'git clean -id (inverse select)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "*" "-5- 1 -2" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -367,18 +367,18 @@ test_expect_success 'git clean -id (ask)' ' docs/manual.txt obj.o build/lib.so && test_write_lines a Y y no yes bad "" | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -389,18 +389,18 @@ test_expect_success 'git clean -id (ask - Ctrl+D)' ' docs/manual.txt obj.o build/lib.so && test_write_lines a Y no yes "\04" | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -412,18 +412,18 @@ test_expect_success 'git clean -id with prefix and path (filter)' ' (cd build/ && test_write_lines f docs "*.h" "" c | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -435,18 +435,18 @@ test_expect_success 'git clean -id with prefix and path (select by name)' ' (cd build/ && test_write_lines s ../docs/ ../src/part3.c ../src/part4.c "" c | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -458,18 +458,18 @@ test_expect_success 'git clean -id with prefix and path (ask)' ' (cd build/ && test_write_lines a Y y no yes bad "" | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' -- 2.34.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [GSOC][PATCH v3 1/1] t7301: use test_path_is_(missing|file) 2024-03-04 17:17 ` [GSOC][PATCH v3 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela @ 2024-03-04 21:50 ` Junio C Hamano 2024-03-04 23:53 ` Eric Sunshine 0 siblings, 1 reply; 14+ messages in thread From: Junio C Hamano @ 2024-03-04 21:50 UTC (permalink / raw) To: Vincenzo Mezzela; +Cc: git Vincenzo Mezzela <vincenzo.mezzela@gmail.com> writes: > Refactor test -f to utilize the corresponding helper functions from As Eric pointed out to another GSoC applicant in a different thread, this is not refactoring any code, so saying "refactor" is a bit misleading. Replace use of "test -f" with the "test_path_is_file" helper function ... > test-lib-functions.sh. These functions perform identical operations > while enhancing debugging capabilities in case of test failures. > > In the context of this file, 'test ! -f' is meant to check if the file > has been correctly cleaned, thus its usage is replaced with > 'test_path_is_missing' instead of '! test_path_is_file'. In other words, the original used "test ! -f" when it meant to say "test ! -e", and test_path_is_missing would be a correct replacement? If so that makes sense. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [GSOC][PATCH v3 1/1] t7301: use test_path_is_(missing|file) 2024-03-04 21:50 ` Junio C Hamano @ 2024-03-04 23:53 ` Eric Sunshine 0 siblings, 0 replies; 14+ messages in thread From: Eric Sunshine @ 2024-03-04 23:53 UTC (permalink / raw) To: Junio C Hamano; +Cc: Vincenzo Mezzela, git On Mon, Mar 4, 2024 at 4:51 PM Junio C Hamano <gitster@pobox.com> wrote: > Vincenzo Mezzela <vincenzo.mezzela@gmail.com> writes: > > Refactor test -f to utilize the corresponding helper functions from > > As Eric pointed out to another GSoC applicant in a different thread, > this is not refactoring any code, so saying "refactor" is a bit > misleading. This is probably a reference to [1], though I was definitely thinking of [2] when I wrote [1], so we come full-circle. [1]: https://lore.kernel.org/git/CAPig+cR2-6qONkosu7=qEQSJa_fvYuVQ0to47D5qx904zW08Eg@mail.gmail.com/ [2]: https://lore.kernel.org/git/xmqqmst2nszq.fsf@gitster.g/ ^ permalink raw reply [flat|nested] 14+ messages in thread
* [GSOC][PATCH v4 0/1] microproject: use test_path_is_* functions in test scripts 2024-03-04 17:17 ` [GSOC][PATCH v3 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 2024-03-04 17:17 ` [GSOC][PATCH v3 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela @ 2024-03-10 11:43 ` Vincenzo Mezzela 2024-03-10 11:43 ` [GSOC][PATCH v4 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela 1 sibling, 1 reply; 14+ messages in thread From: Vincenzo Mezzela @ 2024-03-10 11:43 UTC (permalink / raw) To: gitster; +Cc: git, Vincenzo Mezzela Hi, Following previous discussions[1][2][3][4], this patch is submitted as a microproject for the application to the GSOC. Thanks, Vincenzo Changes in V2: * Fixed commit message[2]. Changes in V3: * Fixed commit message[3]. Changes in V4: * Fixed commit message[4]. [1] https://lore.kernel.org/git/xmqqy1bo5k5h.fsf@gitster.g/ [2] https://lore.kernel.org/git/20240219172214.7644-1-vincenzo.mezzela@gmail.com/ [3] https://lore.kernel.org/git/ZeWVB5uKLONfp6cO@tanuki/ [4] https://lore.kernel.org/git/xmqqcys9oedq.fsf@gitster.g/ Vincenzo Mezzela (1): t7301: use test_path_is_(missing|file) t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ 1 file changed, 245 insertions(+), 245 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [GSOC][PATCH v4 1/1] t7301: use test_path_is_(missing|file) 2024-03-10 11:43 ` [GSOC][PATCH v4 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela @ 2024-03-10 11:43 ` Vincenzo Mezzela 2024-03-11 16:32 ` Junio C Hamano 0 siblings, 1 reply; 14+ messages in thread From: Vincenzo Mezzela @ 2024-03-10 11:43 UTC (permalink / raw) To: gitster; +Cc: git, Vincenzo Mezzela Replace use of 'test -f' with 'test_path_is_file' helper functions from test-lib-functions.sh. These functions perform identical operations while enhancing debugging capabilities in case of test failures. In the context of this file, 'test ! -f' is meant to check if the file has been correctly cleaned, so it should be 'test ! -e'. Thus its usage is replaced with 'test_path_is_missing' instead of '! test_path_is_file'. Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@gmail.com> --- t/t7301-clean-interactive.sh | 490 +++++++++++++++++------------------ 1 file changed, 245 insertions(+), 245 deletions(-) diff --git a/t/t7301-clean-interactive.sh b/t/t7301-clean-interactive.sh index d82a3210a1..4afe53c66a 100755 --- a/t/t7301-clean-interactive.sh +++ b/t/t7301-clean-interactive.sh @@ -25,18 +25,18 @@ test_expect_success 'git clean -i (c: clean hotkey)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo c | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -46,18 +46,18 @@ test_expect_success 'git clean -i (cl: clean prefix)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo cl | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -67,18 +67,18 @@ test_expect_success 'git clean -i (quit)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo quit | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -88,18 +88,18 @@ test_expect_success 'git clean -i (Ctrl+D)' ' touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ docs/manual.txt obj.o build/lib.so && echo "\04" | git clean -i && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -110,18 +110,18 @@ test_expect_success 'git clean -id (filter all)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "*" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -132,18 +132,18 @@ test_expect_success 'git clean -id (filter patterns)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "part3.* *.out" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -154,18 +154,18 @@ test_expect_success 'git clean -id (filter patterns 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines f "* !*.out" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -176,18 +176,18 @@ test_expect_success 'git clean -id (select - all)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "*" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -198,18 +198,18 @@ test_expect_success 'git clean -id (select - none)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -220,18 +220,18 @@ test_expect_success 'git clean -id (select - number)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s 3 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -242,18 +242,18 @@ test_expect_success 'git clean -id (select - number 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "2 3" 5 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -264,18 +264,18 @@ test_expect_success 'git clean -id (select - number 3)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "3,4 5" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -285,11 +285,11 @@ test_expect_success 'git clean -id (select - filenames)' ' touch a.out foo.txt bar.txt baz.txt && test_write_lines s "a.out fo ba bar" "" c | git clean -id && - test -f Makefile && - test ! -f a.out && - test ! -f foo.txt && - test ! -f bar.txt && - test -f baz.txt && + test_path_is_file Makefile && + test_path_is_missing a.out && + test_path_is_missing foo.txt && + test_path_is_missing bar.txt && + test_path_is_file baz.txt && rm baz.txt ' @@ -301,18 +301,18 @@ test_expect_success 'git clean -id (select - range)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "1,3-4" 2 "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test ! -f docs/manual.txt && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_missing docs/manual.txt && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -323,18 +323,18 @@ test_expect_success 'git clean -id (select - range 2)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "4- 1" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test ! -f src/part4.c && - test ! -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_missing src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -345,18 +345,18 @@ test_expect_success 'git clean -id (inverse select)' ' docs/manual.txt obj.o build/lib.so && test_write_lines s "*" "-5- 1 -2" "" c | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -367,18 +367,18 @@ test_expect_success 'git clean -id (ask)' ' docs/manual.txt obj.o build/lib.so && test_write_lines a Y y no yes bad "" | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -389,18 +389,18 @@ test_expect_success 'git clean -id (ask - Ctrl+D)' ' docs/manual.txt obj.o build/lib.so && test_write_lines a Y no yes "\04" | git clean -id && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -412,18 +412,18 @@ test_expect_success 'git clean -id with prefix and path (filter)' ' (cd build/ && test_write_lines f docs "*.h" "" c | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_file docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -435,18 +435,18 @@ test_expect_success 'git clean -id with prefix and path (select by name)' ' (cd build/ && test_write_lines s ../docs/ ../src/part3.c ../src/part4.c "" c | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test -f a.out && - test ! -f docs/manual.txt && - test ! -f src/part3.c && - test -f src/part3.h && - test ! -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_file a.out && + test_path_is_missing docs/manual.txt && + test_path_is_missing src/part3.c && + test_path_is_file src/part3.h && + test_path_is_missing src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' @@ -458,18 +458,18 @@ test_expect_success 'git clean -id with prefix and path (ask)' ' (cd build/ && test_write_lines a Y y no yes bad "" | git clean -id ..) && - test -f Makefile && - test -f README && - test -f src/part1.c && - test -f src/part2.c && - test ! -f a.out && - test ! -f docs/manual.txt && - test -f src/part3.c && - test ! -f src/part3.h && - test -f src/part4.c && - test -f src/part4.h && - test -f obj.o && - test -f build/lib.so + test_path_is_file Makefile && + test_path_is_file README && + test_path_is_file src/part1.c && + test_path_is_file src/part2.c && + test_path_is_missing a.out && + test_path_is_missing docs/manual.txt && + test_path_is_file src/part3.c && + test_path_is_missing src/part3.h && + test_path_is_file src/part4.c && + test_path_is_file src/part4.h && + test_path_is_file obj.o && + test_path_is_file build/lib.so ' -- 2.34.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [GSOC][PATCH v4 1/1] t7301: use test_path_is_(missing|file) 2024-03-10 11:43 ` [GSOC][PATCH v4 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela @ 2024-03-11 16:32 ` Junio C Hamano 0 siblings, 0 replies; 14+ messages in thread From: Junio C Hamano @ 2024-03-11 16:32 UTC (permalink / raw) To: Vincenzo Mezzela; +Cc: git Vincenzo Mezzela <vincenzo.mezzela@gmail.com> writes: > Replace use of 'test -f' with 'test_path_is_file' helper functions from Before "helper functions", we'd need another pair, e.g. and 'test ! -f' with 'test_path_is_missing' otherwise the plurals in the remainder of the paragraph would not make much sense. > test-lib-functions.sh. These functions perform identical operations > while enhancing debugging capabilities in case of test failures. > > In the context of this file, 'test ! -f' is meant to check if the file > has been correctly cleaned, so it should be 'test ! -e'. > Thus its usage is replaced with 'test_path_is_missing' instead of > '! test_path_is_file'. Even if the test meant not to complain when there is something not a regular file (e.g. a directory), "! test_path_is_file" is not the right way to express it, so the way this paragraph is written is somewhat misleading. Something like The original used `test ! -f` but it did not mean that the tests are happy if a directory exists there. It should have used `test ! -e`, and using test_path_is_missing matches the intent. perhaps. ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-03-11 16:32 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-02-19 17:22 [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 2024-02-19 17:22 ` [GSOC][RFC PATCH 1/1] t: t7301-clean-interactive: Use test_path_is_(missing|file) Vincenzo Mezzela 2024-02-26 10:13 ` Christian Couder 2024-02-19 19:36 ` [GSOC][RFC PATCH 0/1] microproject: use test_path_is_* functions in test scripts Eric Sunshine 2024-02-27 16:17 ` [GSOC][PATCH v2 " Vincenzo Mezzela 2024-02-27 16:17 ` [GSOC][PATCH v2 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela 2024-03-04 9:31 ` Patrick Steinhardt 2024-03-04 17:17 ` [GSOC][PATCH v3 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 2024-03-04 17:17 ` [GSOC][PATCH v3 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela 2024-03-04 21:50 ` Junio C Hamano 2024-03-04 23:53 ` Eric Sunshine 2024-03-10 11:43 ` [GSOC][PATCH v4 0/1] microproject: use test_path_is_* functions in test scripts Vincenzo Mezzela 2024-03-10 11:43 ` [GSOC][PATCH v4 1/1] t7301: use test_path_is_(missing|file) Vincenzo Mezzela 2024-03-11 16:32 ` Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).