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

Re: [PATCH v5 1/4] implement submodule config API for lookup of .gitmodules values

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Jul 13, 2015, 11:17 UTC
Message-ID
<20150713111725.GB27160@book.hvoigt.net>
In-Reply-To
<xmqqoajlumnp.fsf@gitster.dls.corp.google.com>
On Thu, Jul 09, 2015 at 01:00:10PM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> Jens Lehmann <Jens.Lehmann@web.de> writes:
> 
> >> How does git-submodule access this information? It looks like it just
> >> hits "git config -f .gitmodules" directly. Perhaps whatever interface is
> >> designed should be suitable for its use here (and if there really is no
> >> more interesting interface needed, then why is "git config" not good
> >> enough for other callers?).
> >
> > The git-submodule script doesn't need this and is fine using plain old
> > "git config", as by the time it is run the .gitmodules file is already
> > updated in the work tree. Heiko's series is about adding infrastructure
> > to allow builtins like checkout and friends to access the configuration
> > values from the .gitmodules file of the to-be-checked-out commit when
> > run with "--recurse-submodules". And yes, if we want to expose this
> > functionality to users or scripts some day "git config" looks like the
> > best place to do that to me too.
> 
> Did you mean "git submodule config"?

I think he actually meant "git config" and that is already implemented. When I implemented the infrastructure to read configurations from blobs, Peff extended it so it will be exposed via the config command line. E.g. you can do:

	git config --blob HEAD^^^:.gitmodules <value>

to get .gitmodules configurations from the history, so that is already implemented. And for reading .gitmodules values we probably do not need more, since calling git from scripting we always have new invocations of processes anyway and that would throw away the cache I am implementing. Reading such values via config from scripts is also more flexible since it supports arbitrary values and my cache only specific values needed by the builtins that use it.

My submodule config cache infrastructure is directed for C-code wanting to query submodule values. So e.g. when "git checkout" wants to know about values but the ".gitmodules" file that is in charge, but has not been checked out yet. We also need this for fetch which will actually need values from more than one revision, since we might need to merge configurations when fetching multiple branches. Fetch also needs information about URLs for new submodules that appear in branches, when auto clone is switched on. That means to support the "I want to go on an airplane get me everything I might need" use-case.

Cheers Heiko
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 16 in “submodule config lookup API”
  1. 0/4 submodule config lookup APIHeiko Voigt, Jun 15, 2015
  2. 1/4 implement submodule config API for lookup of .gitmodules valuesHeiko Voigt, Jun 15, 2015
  3. Heiko VoigtJun 16, 2015
  4. Phil HordJul 8, 2015
  5. Heiko VoigtJul 9, 2015
  6. Jeff KingJul 9, 2015
  7. Jens LehmannJul 9, 2015
  8. Junio C HamanoJul 9, 2015
  9. Heiko VoigtJul 13, 2015
  10. Junio C HamanoJul 13, 2015
  11. 2/4 extract functions for submodule config set and lookupHeiko Voigt, Jun 15, 2015
  12. 3/4 use new config API for worktree configurations of submodulesHeiko Voigt, Jun 15, 2015
  13. 4/4 do not die on error of parsing fetchrecursesubmodules optionHeiko Voigt, Jun 15, 2015
  14. Junio C HamanoJun 15, 2015
  15. Stefan BellerAug 10, 2015
  16. Junio C HamanoAug 12, 2015

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.