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

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

From
BWBrandon Williams <bmwill@google.com>
Date
Sep 27, 2016, 22:09 UTC
Message-ID
<20160927220955.GA38615@google.com>
In-Reply-To
<xmqqwphxknoj.fsf@gitster.mtv.corp.google.com>
On 09/27, Junio C Hamano wrote:
Show 49 quoted lines
> Brandon Williams <bmwill@google.com> writes:
> 
> > Well maybe...I don't really know much about how the prefix interacts in
> > every scenario but would what you describe still work if we are in a sub
> > dir of the superproject (which contains other directorys and perhaps a
> > submodule) and execute a --recurse-submodules command in the
> > subdirectory?  I suspect we don't want to force users to be in the root
> > directory of the project in order to use --recurse-submodules.
> 
> You need to remember "must be at the top" is relevant only to the
> command that is invoked with --super-prefix, not the recursive one
> that drives such a process.
> 
> Suppose your superproject is organized like so:
> 
>     - file-at-top
>       a/file-in-A
>       a/b (submodule)
>       a/b/file-at-top-of-B
>       c/  (submodule)
>       c/file-at-top-of-C
> 
> If you are in a subdirectory of your superproject, say, a/,
> 
>     cd a && git ls-files --recurse-submodules -- "b*"
> 
> I would expect we would recurse into the submodule at "a/b" and find
> "b/file-at-top-of-B".  What does the internal invocation to do so
> would look like?  I would think "git -C b --super=b ls-files" that
> is run from "a".
> 
> Your code would is already prepared to find "file-at-top-of-B" in
> the index of the submodule, prepend "b/" to it and report the result
> as "b/file-at-top-of-B" when such a call is made, I think.
> 
> Now, can you refer to c/ and c/file-at-top-of-C while sitting at a/?
> 
>     cd a && git ls-files --recurse-submodules -- "../c*"
> 
> would be the top-level invocation.  This would iterate over the
> index of the superproject, trying to find what matches "c*" (or,
> "../c*" relative to "a" i.e. where you are), find that 'c' that is a
> submodule, and invoke "git -C ../c --super=../c ls-files"
> internally, I would imagine.  I think your code is prepared to
> accept this case as well.
> 
> In any case, the "must be at the top" does not come into the picture
> at all for the end-user interaction, i.e. invocation of the command
> that is told to recurse into submodules, so we'd be OK.
Thanks for the clear explination that makes sense.
Also, --super-prefix as a name is growing on me :)
-- 
Brandon Williams
Previous: Junio C HamanoNext: Junio C Hamano
Message 28 of 29 in “ls-files: adding support for submodules”
  1. 1/2 ls-files: adding support for submodulesBrandon Williams, Sep 21, 2016
  2. 2/2 ls-files: add pathspec matching for submodulesBrandon Williams, Sep 21, 2016
  3. Junio C HamanoSep 21, 2016
  4. Brandon WilliamsSep 21, 2016
  5. 2/2 ls-files: add pathspec matching for submodulesBrandon Williams, Sep 21, 2016
  6. Junio C HamanoSep 23, 2016
  7. Junio C HamanoSep 23, 2016
  8. Brandon WilliamsSep 23, 2016
  9. Brandon WilliamsSep 21, 2016
  10. Junio C HamanoSep 21, 2016
  11. Brandon WilliamsSep 21, 2016
  12. 1/2 ls-files: optionally recurse into submodulesBrandon Williams, Sep 21, 2016
  13. Jeff KingSep 22, 2016
  14. Brandon WilliamsSep 23, 2016
  15. Junio C HamanoSep 21, 2016
  16. Jeff KingSep 22, 2016
  17. Stefan BellerSep 22, 2016
  18. Junio C HamanoSep 22, 2016
  19. Jeff KingSep 23, 2016
  20. Stefan BellerSep 23, 2016
  21. Jeff KingSep 23, 2016
  22. Brandon WilliamsSep 23, 2016
  23. Stefan BellerSep 23, 2016
  24. Nazri RamliySep 25, 2016
  25. Junio C HamanoSep 27, 2016
  26. Brandon WilliamsSep 27, 2016
  27. Junio C HamanoSep 27, 2016
  28. Brandon WilliamsSep 27, 2016
  29. Junio C HamanoSep 27, 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.