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

Re: Re: [PATCH 2/5] implement submodule config cache for lookup of submodule names

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Jun 6, 2014, 05:20 UTC
Message-ID
<20140606052040.GA77405@book.hvoigt.net>
In-Reply-To
<20140605174610.GS21803@odin.tremily.us>
On Thu, Jun 05, 2014 at 10:46:10AM -0700, W. Trevor King wrote:
Show 16 quoted lines
> On Thu, Jun 05, 2014 at 08:07:50AM +0200, Heiko Voigt wrote:
> > +The caller can look up information about submodules by using the
> > +`submodule_from_path()` or `submodule_from_name()` functions.
> 
> That's for an already-known submodule.  Do we need a way to list
> submodules (e.g. for 'submodule foreach' style operations) or is the
> preferred way to do that just walking the tree looking for gitlinks?
> The cases where .gitmodules would lead you astray (e.g. via sloppy
> commits after removing a submodule) are:
> 
> * Listing a submodule that wasn't in the tree anymore.  Easy to check
>   for and ignore.
> 
> * Not listing a submodule that is in the tree.  You'd need to walk the
>   tree to check for this, but it's a pretty broken situation already,
>   so I'd be fine just ignoring the orphaned gitlink.

Currently there is no need to list the submodules in a .gitmodule file. We currently always begin from the gitlink and try to do things. If we have enough information thats fine we go ahead, if not we stop (or skip?) the submodule. So for already initialized submodules it is even ok to not have a .gitmodules entry at all and we can still go ahead with most operations. Here we should not be too picky, I think.

The only use-case I can think of is for checking whether .gitmodules contains any extra unneeded values. But on the other hand that is not so easy. Since .gitmodules are just config files they can contain user defined values. That is ok.

So in summary: Yes the preferred way to list submodules is via iterating the gitlinks and I do not think we need a way to iterate through the .gitmodules file (at least not for the use-cases we currently need this for).

Cheers Heiko
Previous: W. Trevor KingNext: Eric Sunshine
Message 12 of 26 in “submodule config lookup API”
  1. 0/5 submodule config lookup APIHeiko Voigt, Jun 5, 2014
  2. 1/5 hashmap: add enum for hashmap free_entries optionHeiko Voigt, Jun 5, 2014
  3. Karsten BleesJun 6, 2014
  4. Heiko VoigtJun 10, 2014
  5. Karsten BleesJun 11, 2014
  6. Junio C HamanoJun 12, 2014
  7. Karsten BleesJun 17, 2014
  8. Heiko VoigtJun 17, 2014
  9. Junio C HamanoJun 17, 2014
  10. 2/5 implement submodule config cache for lookup of submodule namesHeiko Voigt, Jun 5, 2014
  11. W. Trevor KingJun 5, 2014
  12. Heiko VoigtJun 6, 2014
  13. Eric SunshineJun 8, 2014
  14. Heiko VoigtJun 10, 2014
  15. Junio C HamanoJun 12, 2014
  16. Heiko VoigtJun 13, 2014
  17. 3/5 extract functions for submodule config set and lookupHeiko Voigt, Jun 5, 2014
  18. 4/5 use new config API for worktree configurations of submodulesHeiko Voigt, Jun 5, 2014
  19. 5/5 do not die on error of parsing fetchrecursesubmodules optionHeiko Voigt, Jun 5, 2014
  20. Junio C HamanoJun 12, 2014
  21. Heiko VoigtJun 13, 2014
  22. Junio C HamanoJun 16, 2014
  23. Heiko VoigtJun 17, 2014
  24. Junio C HamanoJun 12, 2014
  25. Jens LehmannJun 13, 2014
  26. Junio C HamanoJun 13, 2014

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.