On 12/8/2021 12:04 PM, Elijah Newren wrote: > On Wed, Dec 8, 2021 at 7:14 AM Derrick Stolee <stolee@xxxxxxxxx> wrote: >> Taking your idea and applying it to 'ls-files' (without --stage to >> avoid OIDs which would change depending on the hash algorithm), the >> start of the test looks like this: >> >> test_expect_success 'ls-files' ' >> init_repos && >> >> # Behavior agrees by default. Sparse index is expanded. >> test_all_match git ls-files && >> >> # With --sparse, the sparse index data changes behavior. >> git -C sparse-index ls-files --stage >out && >> git -C sparse-index ls-files --stage --sparse >sparse && >> >> cat >expect <<-\EOF && >> e >> folder1- >> folder1.x >> -folder1/0/0/0 >> -folder1/0/1 >> -folder1/a >> +folder1/ >> folder10 >> -folder2/0/0/0 >> -folder2/0/1 >> -folder2/a >> +folder2/ >> g >> -x/a >> +x/ >> z >> EOF >> >> diff -u out sparse | tail -n 16 >actual && >> test_cmp expect actual >> ' > > This actually looks quite nice, though the magic '16' is kind of > annoying. Could we get rid of that -- perhaps using something to rip > out the diff header, or using comm instead? What I really want is "remove the first two lines of this file" but perhaps "tail -n $(wc -l expect)" would suffice to avoid a magic number? > Also, perhaps 'dense' rather than 'out'? Sounds good. Thanks, -Stolee