git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 4 of 10 in “ls-files: support --recurse-submodules --stage”
  1. ls-files: support --recurse-submodules --stageJonathan Tan, Feb 18, 2022
  2. Junio C HamanoFeb 19, 2022
  3. Ævar Arnfjörð BjarmasonFeb 19, 2022
  4. Taylor BlauFeb 19, 2022
  5. Junio C HamanoFeb 21, 2022
  6. Ævar Arnfjörð BjarmasonFeb 21, 2022
  7. Jonathan TanFeb 24, 2022
  8. Junio C HamanoFeb 21, 2022
  9. Taylor BlauFeb 21, 2022
  10. ls-files: support --recurse-submodules --stageJonathan Tan, Feb 24, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.