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
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 18, 2009, 18:33 UTC
Message-ID
<alpine.DEB.1.00.0901181929220.3586@pacific.mpi-cbg.de>
In-Reply-To
<8c5c35580901180945u17a69140vff2736765ee6073@mail.gmail.com>
Hi,
On Sun, 18 Jan 2009, Lars Hjemli wrote:
Show 33 quoted lines
> On Sun, Jan 18, 2009 at 16:48, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>
> > On Sun, 18 Jan 2009, Lars Hjemli wrote:
> >
> >> +                  struct tree **subtree)
> >> +{
> >> +     unsigned char sha1[20];
> >> +     int linked_odb = 0;
> >> +     struct commit *commit;
> >> +     void *buffer;
> >> +     enum object_type type;
> >> +     unsigned long size;
> >> +
> >> +     hashcpy(sha1, commit_sha1);
> >> +     if (!add_gitlink_odb(path)) {
> >> +             linked_odb = 1;
> >> +             if (resolve_gitlink_ref(path, "HEAD", sha1))
> >> +                     die("Unable to lookup HEAD in %s", path);
> >> +     }
> >
> > Why would you want to continue if add_gitlink_odb() did not find a checked
> > out submodule?
> >
> > Seems you want to fall back to look in the superproject's object database.
> > But I think that is wrong, as I have a superproject with many platform
> > dependent submodules, only one of which is checked out, and for
> > convenience, the submodules all live in the superproject's repository.
> 
> Actually, I want this to work for bare repositories by specifying the
> submodule odbs in the alternates file. So if the current submodule odb
> wasn't found my plan was to check if the commit object was accessible
> anyways but don't die() if it wasn't.

Please make that an explicit option (cannot think of a good name, though), otherwise I will not be able to use your feature. Making it the default would be inconsistent with the rest of our submodules framework.

Show 9 quoted lines
> >> +     commit = lookup_commit(sha1);
> >> +     if (!commit)
> >> +             die("traverse_gitlink(): internal error");
> >
> > s/internal error/could not access commit '%s' of submodule '%s'",
> >                        sha1_to_hex(sha1), path);/
> 
> Ok (I belive this codepath is virtually impossible to hit, hence the
> "internal error", but I could of course be mistaken).

You make it a function that is exported to other parts of Git in cache.h. So you might just as well expect it to be used by other parts at some stage.

Ciao, Dscho

Previous: Lars HjemliNext: Lars Hjemli
Message 8 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.