Re: [PATCH v4 1/2] t1092: add tests for `git diff-files`
- From
Shuqi Liang <cheskaqiqi@gmail.com>
- Date
- Mar 9, 2023, 23:21 UTC
- Message-ID
- <CAMO4yUFs5zSafO1pGFZqBU9R58G8ENhfTh5qNayeFMRPrCa+Jg@mail.gmail.com>
- In-Reply-To
- <xmqqmt4lc03s.fsf@gitster.g>
Hi Junio
On Thu, Mar 9, 2023 at 12:20 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
> > > + 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.
Will do !
Show 7 quoted lines
> 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.
Agree!
Show 6 quoted lines
> > + # 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?
I wonder if the method below is good to test the actual output for ' file present on-disk with modifications' :
cat >expect <<-EOF &&
:100644 100644 8e27be7d6154a1f68ea9160ef0e18691d20560dc
0000000000000000000000000000000000000000 M newdirectory/testfile
EOF # file present on-disk with modifications
run_on_sparse ../edit-contents newdirectory/testfile &&
test_sparse_match git diff-files &&
test_cmp expect sparse-checkout-out &&
test_sparse_match git diff-files newdirectory/testfile &&
test_cmp expect sparse-checkout-out------------------- Thanks, Shuqi