Re: [PATCH 1/2] ls-files: adding support for submodules
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 27, 2016, 22:23 UTC
- Message-ID
- <xmqqh991kmnt.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160927220955.GA38615@google.com>
Brandon Williams <bmwill@google.com> writes:
Show 8 quoted lines
>> 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".
Actually, the internal invocation may have to be
$ git --super=a/b ls-files -- "a/b*"
if the desired overall output needs to be in the "--full-name" mode. That is, the top-level recursive one may be
cd a && git ls-files --recurse-submodules --full-name -- "b*"
This top-level "ls-files" will have "prefix" set to "a/". Because it is run in the "--full-name" mode, after finding that the submodule at "a/b" matches the given pathspec and deciding to recurse into it, it needs to arrange that paths stored in the index of the submodule are prefixed with "a/b/", not with "b/", when shown.