Subject: Re: [PATCH v4 1/2] t1092: add tests for `git diff-files`

From: Junio C Hamano <[email-masked]>
Date: Thu, 09 Mar 2023 09:20:55 -0800

Shuqi Liang <[email-masked]> writes:

> +	run_on_all ../edit-contents deep/a &&
> +
> +	test_all_match git diff-files  &&

An extra space on this line.

> +	test_all_match git diff-files deep/a 

And on this line.

No need to resend only to correct the above two, but if you are
going to reroll to fix something else, please make sure fixing
them.

> +'
> +
> +test_expect_success 'diff-files with pathspec outside sparse definition' '
> +	init_repos &&
> +
> +	write_script edit-contents <<-\EOF &&
> +	echo text >>"$1"
> +	EOF
> +
> +	# add file to the index but outside of cone
> +	run_on_sparse mkdir newdirectory &&
> +	run_on_sparse ../edit-contents newdirectory/testfile &&
> +	test_sparse_match git add --sparse newdirectory/testfile &&
> +
> +	# file present on-disk without modifications
> +	test_sparse_match git diff-files &&
> +	test_must_be_empty sparse-checkout-out &&
> +	test_must_be_empty sparse-index-out &&

As output from checkout and index are known to be identical (that is
one of the things that test_sparse_match does), I do not think there
is much point checking -out from both sides.

If we know "diff-files" invocation above should never send anything
to the standard error, then checking that sparse-checkout-err is
empty may have value, though.

> +	test_sparse_match git diff-files newdirectory/testfile &&
> +	test_must_be_empty sparse-checkout-out &&
> +	test_must_be_empty sparse-index-out &&

Ditto.

> +	# file present on-disk with modifications
> +	run_on_sparse ../edit-contents newdirectory/testfile &&
> +	test_sparse_match git diff-files &&
> +	test_sparse_match git diff-files newdirectory/testfile 

We do not care what the actual output is in this case?

> +'
> +
>  test_done

Thanks.