git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/2] modernize t7300

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 7, 2015, 21:40 UTC
Message-ID
<xmqq610alyy5.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1449413906-23256-1-git-send-email-rouzier@gmail.com>
James <rouzier@gmail.com> writes:
> From: James Rouzier <rouzier@gmail.com>
>
> ---
Missing sign-off.
Show 24 quoted lines
>  t/t7300-clean.sh | 382 +++++++++++++++++++++++++++----------------------------
>  1 file changed, 190 insertions(+), 192 deletions(-)
>
> diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
> index 86ceb38..d555bb6 100755
> --- a/t/t7300-clean.sh
> +++ b/t/t7300-clean.sh
> @@ -28,15 +28,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '
>  	mkdir -p build docs &&
>  	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
>  	git clean &&
> -	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 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 &&
OK.
> +	test_path_is_missing a.out &&
> +	test_path_is_missing src/part3.c &&

This is better than the original, which may have said "OK" upon seeing a directory called "a.out".

> +	test_path_is_file docs/manual.txt &&
> +	test_path_is_file obj.o &&
> +	test_path_is_file build/lib.so &&
OK.
Show 25 quoted lines
>  	git update-index --no-skip-worktree .gitignore &&
>  	git checkout .gitignore
>  '
> @@ -46,15 +46,15 @@ test_expect_success 'git clean' '
>  	mkdir -p build docs &&
>  	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
>  	git clean &&
> -	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 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_file docs/manual.txt &&
> +	test_path_is_file obj.o &&
> +	test_path_is_file build/lib.so

The verbosity of this conversion makes me wonder if we want to have "test_paths_are_files" and "test_paths_are_missing". For that matter, this test does not really care about the distinction between files and directories (e.g. some tests said "test ! -d docs" and would have passed if there were a 'docs' regular file, but what we really care about is the path 'docs' is _gone_), so what we want may be test_paths_exist and test_paths_are_missing. With that, the above hunk would become

	test_paths_exist Makefile README src/part1.c src/part2.c \
		obj.o build/lib.so &&
        test_paths_are_missing a.out src/part3.c
I dunno.
Show 24 quoted lines
>  test_expect_success 'git clean -e' '
>  	rm -fr repo &&
>  	mkdir repo &&
> -	(
> -		cd repo &&
> -		git init &&
> -		touch known 1 2 3 &&
> -		git add known &&
> -		git clean -f -e 1 -e 2 &&
> -		test -e 1 &&
> -		test -e 2 &&
> -		! (test -e 3) &&
> -		test -e known
> -	)
> +	cd repo &&
> +	git init &&
> +	touch known 1 2 3 &&
> +	git add known &&
> +	git clean -f -e 1 -e 2 &&
> +	test_path_is_file 1 &&
> +	test_path_is_file 2 &&
> +	test_path_is_missing 3 &&
> +	test_path_is_file known
>  '

I think this is wrong. The next test piece will be run inside "repo" directory with this patch applied. Don't lose the subshell here.

Previous: Eric SunshineNext: Eric Sunshine
Message 18 of 21 in “clean: new option --exclude-from”
  1. clean: new option --exclude-fromJames, Nov 26, 2015
  2. Eric SunshineNov 30, 2015
  3. Jeff KingDec 2, 2015
  4. Junio C HamanoDec 2, 2015
  5. Jeff KingDec 2, 2015
  6. Junio C HamanoDec 2, 2015
  7. Jeff KingDec 2, 2015
  8. Junio C HamanoDec 2, 2015
  9. Jeff KingDec 2, 2015
  10. Junio C HamanoDec 6, 2015
  11. Jeff KingDec 7, 2015
  12. Eric SunshineDec 1, 2015
  13. 1/2 modernize t7300James, Dec 6, 2015
  14. 2/2 clean: new option --exclude-fromJames, Dec 6, 2015
  15. Jeff KingDec 7, 2015
  16. Junio C HamanoDec 7, 2015
  17. Eric SunshineDec 7, 2015
  18. Junio C HamanoDec 7, 2015
  19. Eric SunshineDec 7, 2015
  20. Junio C HamanoDec 7, 2015
  21. Eric SunshineDec 7, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.