Re: [PATCH] ls-files: support --recurse-submodules --stage
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Feb 19, 2022, 03:50 UTC
- Message-ID
- <YhBo+hg8yxIOGKNS@nand.local>
- In-Reply-To
- <220219.868ru7fsad.gmgdl@evledraar.gmail.com>
On Sat, Feb 19, 2022 at 04:11:30AM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 8 quoted lines
> But why do we need to test the OID abbreviation at all, isn't that a bit > too much paranoia? Isn't it sufficient just do: > > opts="--stage --abbrev=4" && > git -C submodule ls-files $opts >expect && > git ls-files --recurse-submodules $opts --stage >raw && > grep submodule raw >actual && > test_cmp expect actual
Yeah; I like this direction. I try to err on the side of reconstructing the whole output and then calling test_cmp on it. I usually go that way because it's nice for somebody reading the test script to see what the output is supposed to look like.
But because you have to have a bunch of $(git rev-parse --short=4 ...) in subshells everywhere in order to produce the right output, I don't think the result resembles the actual output in this case.
I'd probably go a bit further than what you propose, maybe replacing that grep with:
grep "0.submodule" actual
to make sure that we got the correct stage number, too. But I agree with you on the general direction.
Thanks, Taylor