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

Re: Running git-archive recursively over submodules

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Feb 16, 2010, 10:49 UTC
Message-ID
<4B7A784C.1070405@drmicha.warpmail.net>
In-Reply-To
<201002161101.42493.trast@student.ethz.ch>
Thomas Rast venit, vidit, dixit 16.02.2010 11:01:
Show 16 quoted lines
> On Tuesday 16 February 2010 08:38:08 Michael J Gruber wrote:
>> Thomas Rast venit, vidit, dixit 15.02.2010 21:56:
>>> while git ls-files -s | grep -q ^160000; do
>>>     read_one_level
>>> done
>>
>> Am I blind, not seeing a recursion, or is there simply none? I reckon
>> you're reading the super project and one level of submodules into the
>> temporary index - which is fine for most purposes, of course. I would
>> say this is iterating over the submodules of the super project.
> 
> Well, the while condition reads "while there are submodule entries in
> my index".  The read_one_level function then replaces those submodules
> with their corresponding trees, which of course may again contain
> submodule entries.
> 

Gotcha, and the rm --cached in foreach makes sure that submodule entries disappear from the index once their contents have been read into it, so that the recursion stops when there's no deeper level. Clever.

Thanks for helping my for/while blindness (I guess I was thinking "for").

Cheers, Michael

Previous: Thomas Rast
Message 4 of 4 in “Running git-archive recursively over submodules”
  1. Thomas RastFeb 15, 2010
  2. Michael J GruberFeb 16, 2010
  3. Thomas RastFeb 16, 2010
  4. Michael J GruberFeb 16, 2010

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.