Subject: Re: [PATCH v2 5/5] Add tests around status handling of ignored arguments

From: Junio C Hamano <[email-masked]>
Date: Thu, 12 Oct 2017 13:06:06 +0900

Jameson Miller <[email-masked]> writes:

> Add tests for status handling of '--ignored=matching` and
> `--untracked-files=normal`.
>
> Signed-off-by: Jameson Miller <[email-masked]>
> ---

Hmph, having some tests in 3/5, changes in 4/5 and even more tests
in 5/5 makes me as a reader a bit confused, as the description for
these two test patches does not make it clear how they are related
and how they are different.  Is it that changes in 1/5 alone does
not fulfill the promise made by documentation added at 2/5 so 3/5
only has tests for behaviour that works with 1/5 alone but is broken
with respect to what 2/5 claims until 4/5 is applied, and these "not
working with 1/5 alone, but works after 4/5" are added in this step?

>  t/t7519-ignored-mode.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 59 insertions(+), 1 deletion(-)
>
> diff --git a/t/t7519-ignored-mode.sh b/t/t7519-ignored-mode.sh
> index 76e91427b0..6be7701d79 100755
> --- a/t/t7519-ignored-mode.sh
> +++ b/t/t7519-ignored-mode.sh
> @@ -116,10 +116,68 @@ test_expect_success 'Verify status behavior on ignored folder containing tracked
>  		ignored_dir/ignored_1.ign ignored_dir/ignored_2.ign \
>  		ignored_dir/tracked &&
>  	git add -f ignored_dir/tracked &&
> -	test_tick &&
>  	git commit -m "Force add file in ignored directory" &&
>  	git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
>  	test_i18ncmp expect output
>  '
>  
> +test_expect_success 'Verify matching ignored files with --untracked-files=normal' '
> +	test_when_finished "git clean -fdx" &&
> +	cat >expect <<-\EOF &&
> +	? expect
> +	? output
> +	? untracked_dir/
> +	! ignored_dir/
> +	! ignored_files/ignored_1.ign
> +	! ignored_files/ignored_2.ign
> +	EOF
> +
> +	mkdir ignored_dir ignored_files untracked_dir &&
> +	touch ignored_dir/ignored_1 ignored_dir/ignored_2 \
> +		ignored_files/ignored_1.ign ignored_files/ignored_2.ign \
> +		untracked_dir/untracked &&
> +	git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
> +	test_i18ncmp expect output
> +'
> +
> +test_expect_success 'Verify matching ignored files with --untracked-files=normal' '
> +	test_when_finished "git clean -fdx" &&
> +	cat >expect <<-\EOF &&
> +	? expect
> +	? output
> +	? untracked_dir/
> +	! ignored_dir/
> +	! ignored_files/ignored_1.ign
> +	! ignored_files/ignored_2.ign
> +	EOF
> +
> +	mkdir ignored_dir ignored_files untracked_dir &&
> +	touch ignored_dir/ignored_1 ignored_dir/ignored_2 \
> +		ignored_files/ignored_1.ign ignored_files/ignored_2.ign \
> +		untracked_dir/untracked &&
> +	git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
> +	test_i18ncmp expect output
> +'
> +
> +test_expect_success 'Verify status behavior on ignored folder containing tracked file' '
> +	test_when_finished "git clean -fdx && git reset HEAD~1 --hard" &&
> +	cat >expect <<-\EOF &&
> +	? expect
> +	? output
> +	! ignored_dir/ignored_1
> +	! ignored_dir/ignored_1.ign
> +	! ignored_dir/ignored_2
> +	! ignored_dir/ignored_2.ign
> +	EOF
> +
> +	mkdir ignored_dir &&
> +	touch ignored_dir/ignored_1 ignored_dir/ignored_2 \
> +		ignored_dir/ignored_1.ign ignored_dir/ignored_2.ign \
> +		ignored_dir/tracked &&
> +	git add -f ignored_dir/tracked &&
> +	git commit -m "Force add file in ignored directory" &&
> +	git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
> +	test_i18ncmp expect output
> +'
> +
>  test_done