Re: [PATCH v2 1/2] t1092: add tests for `git diff-files`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 8, 2023, 22:40 UTC
- Message-ID
- <xmqqbkl2sw8o.fsf@gitster.g>
- In-Reply-To
- <CAMO4yUHEDtZfu+NgsWNjckxAun9kU+8GoyB_poWT8Lam095Wtw@mail.gmail.com>
Shuqi Liang <cheskaqiqi@gmail.com> writes:
Show 19 quoted lines
>> We create a new directory that is outside the cone, with or without >> using the sparse-index feature. We know we are violating the cone, >> and have to override the safety with the "--sparse" option. OK. >> >> What output do we expect out of "git add" to match in the two cases? >> >> > + #file present on-disk without modifications >> > + test_sparse_match git diff-files && >> > + test_sparse_match git diff-files newdirectory/testfile && >> >> As "diff-files" is about comparing between the index and the working >> tree, the new path should not appear in the output when the sparse >> checkout feature with or without the sparse-index feature is NOT in >> use. Does the picture get different when we are sparse? IOW, would >> we notice that we now have newdirectory/testfile that is supposed to >> be missing in the index and show that in the output? > > I'm a bit caught up here. > Do you mean I need to add a test for "git add" also?
Not really. The above two tests are happy with _any_ output coming out of "git diff-files" (and "git diff-files nd/tf") as long as they match between sparse checkouts, one of which uses and the other does not use the sparse index feature. I was wondering if we want to be a bit stricter than that. Thinks like "not only the two output must match, they both must be empty".