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

Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules

From
LHLars Hjemli <hjemli@gmail.com>
Date
Jan 18, 2009, 22:46 UTC
Message-ID
<8c5c35580901181446n3c36a345m5d8e78764a85c123@mail.gmail.com>
In-Reply-To
<alpine.DEB.1.00.0901182244310.3586@pacific.mpi-cbg.de>

On Sun, Jan 18, 2009 at 22:55, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 18 quoted lines
> Hi,
>
> On Sun, 18 Jan 2009, Lars Hjemli wrote:
>
>> So, would you rather have something like `git archive --submodules=foo
>> --submodules=bar HEAD` to explicitly tell which submodule paths to
>> include in the archive when executed in a bare repo?
>
> That does not quite say what you tried to do, does it?  You tried to
> traverse submodules whose commit can be found in the object database.
>
> Setting aside the fact that we usually try to avoid accessing unreachable
> objects, which your handling does not do, our "git submodule" does not do
> that either; it only handles submodules that are checked out.
>
> Now, this behavior might be wanted, in bare as well as in non-bare
> repositories, but I think it should be triggered by an option, such as
> "--submodules=look-in-superprojects-odb".

Sorry, but if your concern is whether to traverse a submodule in a bare repo when the submodule isn't checked out (yeah, contradiction in terms), I just don't see the point.

For non-bare repositories the policy has always been to ignore submodules which isn't checked out, but for bare repositories there is no obvious way (for me, at least) to apply the same policy. Therefore I proposed to traverse all submodules where the linked commit is reachable, but as you pointed out this would be wrong for non-bare repositories.

I then modified my proposal to include a check on is_bare_repository(): If we're not in a bare repository, read_tree_recursive() is only allowed to recurse into checked out submodules. But if we're in a bare repository, read_tree_recursive() is allowed to recurse into any submodule with a reachable commit.

Now then, if `--submodules=look-in-superprojects-odb` should be required to trigger the latter behavior, running `git archive --submodules HEAD` in a bare repository would always produce identical output as `git archive HEAD` and this is why I don't understand the gain of 'look-in-superprojects-odb' (I thought you wanted to limit which of the reachable submodules to recurse into).

-- larsh

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 13 of 26 in “Implement 'git archive --submodules'”
  1. 0/3 Implement 'git archive --submodules'Lars Hjemli, Jan 18, 2009
  2. 1/3 sha1_file: add function to insert alternate object dbLars Hjemli, Jan 18, 2009
  3. 2/3 Teach read_tree_recursive() how to traverse into submodulesLars Hjemli, Jan 18, 2009
  4. 3/3 git-archive: add support for --submodulesLars Hjemli, Jan 18, 2009
  5. Johannes SchindelinJan 18, 2009
  6. Johannes SchindelinJan 18, 2009
  7. Lars HjemliJan 18, 2009
  8. Johannes SchindelinJan 18, 2009
  9. Lars HjemliJan 18, 2009
  10. Johannes SchindelinJan 18, 2009
  11. Lars HjemliJan 18, 2009
  12. Johannes SchindelinJan 18, 2009
  13. Lars HjemliJan 18, 2009
  14. Johannes SchindelinJan 19, 2009
  15. 1/1 bug fix, diff whitespace ignore optionsKeith Cascio, Jan 19, 2009
  16. Johannes SchindelinJan 19, 2009
  17. 1/1 bug fix, diff whitespace ignore optionsKeith Cascio, Jan 19, 2009
  18. Johannes SchindelinJan 19, 2009
  19. Junio C HamanoJan 20, 2009
  20. Junio C HamanoJan 19, 2009
  21. René ScharfeJan 18, 2009
  22. Lars HjemliJan 18, 2009
  23. Junio C HamanoJan 18, 2009
  24. Lars HjemliJan 18, 2009
  25. Johannes SchindelinJan 18, 2009
  26. sha1_file: add function to insert alternate object dbLars Hjemli, Jan 18, 2009

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.