Subject: Re: [PATCH v4 1/2] format-patch: create leading components of output directory

From: SZEDER Gábor <[email-masked]>
Date: Fri, 11 Oct 2019 16:46:50 +0200

On Fri, Oct 11, 2019 at 10:36:41AM +0200, Bert Wesarg wrote:
> Changes in v4:
>  * based on dl/format-patch-doc-test-cleanup and adopt it

Thanks...  but here I am nitpicking again, sorry :)

> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index 72b09896cf..9facc3a79e 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -1606,6 +1606,29 @@ test_expect_success 'From line has expected format' '
>  	test_cmp from filtered
>  '
>  
> +test_expect_success 'format-patch -o with no leading directories' '
> +	rm -fr patches &&
> +	git format-patch -o patches master..side &&
> +	count=$(git rev-list --count master..side) &&
> +	ls patches >list &&
> +	test_line_count = $count list
> +'
> +
> +test_expect_success 'format-patch -o with leading existing directories' '
> +	git format-patch -o patches/side master..side &&

The previous test case creates the 'patches' directory and leaves it
behind, and this test implicitly relies on that directory to check
that 'format-patch -o' can deal with already existing directories.  So
if the previous test case were to fail early or were not run at all
(e.g. './t4014-format-patch.sh -r 1,137'), then that directory
wouldn't exist, and, consequently, this test case would not check what
it was supposed to.

I think it would be better to be more explicit and self-contained
about it, and create a leading directory in this test case:

   mkdir existing-dir &&
   git format-patch -o existing-dir/side master..size &&
   ls existing-dir/side >list &&

> +	count=$(git rev-list --count master..side) &&
> +	ls patches/side >list &&
> +	test_line_count = $count list
> +'
> +
> +test_expect_success 'format-patch -o with leading non-existing directories' '
> +	rm -fr patches &&
> +	git format-patch -o patches/side master..side &&
> +	count=$(git rev-list --count master..side) &&
> +	ls patches/side >list &&
> +	test_line_count = $count list
> +'
> +
>  test_expect_success 'format-patch format.outputDirectory option' '
>  	test_config format.outputDirectory patches &&
>  	rm -fr patches &&
> -- 
> 2.23.0.13.g28bc381d7c
>