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

Re: [RFC/PATCH] ls-files: adding support for submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 11, 2016, 22:10 UTC
Message-ID
<xmqqmvje6qbe.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79kaWNykEAZcjZ2Y19j2_3TF+qcz+vb8zSi1U+me3k+06LA@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
> The plan is to hook the ls-files machinery into
> git-grep as the way of obtaining files to grep for a pattern.

That does not make much sense to me for exactly the same reason why the "grab the list of paths and run 'git add' on them" example in the message you are responding to does not make sense. The use of the thread-pool would still need to honor the submodule boundary so that one thread may be assigned files in the top-level superproject while another may be assigned files in lib/ submodule repository, and the latter would be doing a rough equivalent of "git -C lib grep" perhaps with a new option "--output-path-prefix=lib/" that makes any and all paths that are reported from the command prefixed with the specified string, so the result of its grepping in Makefile may be reported as findings in lib/Makefile.

For that, it is not sufficient for the enumeration of paths done in the top-level to just list lib/Makefile and lib/hello.py along with Makefile and main.py, is it? You would somehow need to have a way to tell that 'lib/' and everything in there is inside a separate repository. Without knowing that "lib/" is its own repository, you would not even know which files under "lib/" hierarchy in the filesystem are actually tracked files, which you would learn only by reading lib/.git/index, or what textconv filtering needs to be done on them, which you would learn only by reading lib/.gitattributes and/or lib/.git/config.

So a "ls-files" that is done internally in the end-user facing "git grep --recurse-submodules" needs to be run _without_ recursing itself at least once to learn "lib/" is a submodule. A flat "here are everything we have" does not sound like a good building block.

Previous: Stefan BellerNext: Jeff King
Message 6 of 22 in “ls-files: adding support for submodules”
  1. ls-files: adding support for submodulesBrandon Williams, Sep 9, 2016
  2. Jeff KingSep 9, 2016
  3. Junio C HamanoSep 9, 2016
  4. Junio C HamanoSep 9, 2016
  5. Stefan BellerSep 9, 2016
  6. Junio C HamanoSep 11, 2016
  7. Jeff KingSep 12, 2016
  8. Jeff KingSep 12, 2016
  9. Junio C HamanoSep 12, 2016
  10. Junio C HamanoSep 12, 2016
  11. ls-files: adding support for submodulesBrandon Williams, Sep 13, 2016
  12. Brandon WilliamsSep 13, 2016
  13. Junio C HamanoSep 13, 2016
  14. Junio C HamanoSep 15, 2016
  15. Junio C HamanoSep 15, 2016
  16. Junio C HamanoSep 15, 2016
  17. Junio C HamanoSep 15, 2016
  18. 2/2 SQUASH??? UndecidedJunio C Hamano, Sep 15, 2016
  19. Stefan BellerSep 15, 2016
  20. Brandon WilliamsSep 15, 2016
  21. 1/2 SQUASH???Junio C Hamano, Sep 15, 2016
  22. Brandon WilliamsSep 12, 2016

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.