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

Re: sudmodule.<name>.recurse ignored

From
MTMichael S. Tsirkin <mst@redhat.com>
Date
Oct 11, 2022, 22:34 UTC
Message-ID
<20221011182119-mutt-send-email-mst@kernel.org>
In-Reply-To
<xmqq35bze3rr.fsf@gitster.g>
On Fri, Oct 07, 2022 at 02:13:12PM -0700, Junio C Hamano wrote:
Show 28 quoted lines
> Glen Choo <chooglen@google.com> writes:
> 
> > - where to get the submodule from during a fetch/clone, e.g.
> >   `submodule.<name>.url`, `submodule.<name>.branch`
> > - information needed for submodules to work correctly, e.g.
> >   `submodule.<name>.path`
> > - default config that gets populated in .git/config via `git submodule
> >   init`, e.g. `submodule.<name>.update`,
> >   `submodule.<name>.fetchRecurseSubmodules`
> >
> > With respect to config, the general stance is that .gitmodules is meant
> > to provide defaults for .git/config and _not_ to be read directly (see
> > Ævar's answer).
> 
> I think that is a sensible way to think about this.
> 
> It is more like "suggestion made by the upstream", to be taken after
> examining it, just like you should type "make" after examining the
> Makefile.  At least enough to trust its contents ;-)
> 
> > There are some very limited cases where config is read
> > directly from .gitmodules, but that approach is very frowned upon and
> > it's unlikely that we'll add more of them in the future.
> 
> Yup, we should be careful and see if we can get rid of existing
> uses.
> 
> Thanks.
Fundamentally the problem we encounter regularly is this:
	qemu is superproject, ui/keycodemapdb is subproject.
	I have a change on master setting the submodule commit:
	qemu$ git show master | grep +Sub
	+Subproject commit 7381b9bfadd31c4c9e9a10b5bb5032f9189d4352
	and check it out:
	qemu$ git submodule update --init ui/keycodemapdb
	Submodule 'ui/keycodemapdb' (https://gitlab.com/qemu-project/keycodemapdb.git) registered for path 'ui/keycodemapdb'
	Submodule path 'ui/keycodemapdb': checked out '7381b9bfadd31c4c9e9a10b5bb5032f9189d4352'
	In another branch I have a different commit:
	qemu$ git show sub-foo  | grep +Sub
	+Subproject commit 57ba70da5312170883a3d622cd2aa3fd0e2ec7ae
	Now I switch branches and nothing happens, the submodule
	is marked as dirty:
	qemu$ git checkout sub-foo
	M       ui/keycodemapdb
	Switched to branch 'sub-foo'
	qemu$ (cd ui/keycodemapdb && git show | head -1)
	commit 7381b9bfadd31c4c9e9a10b5bb5032f9189d4352
it is now very easy to generate incorrect code:
- git commit -a  will commit the change to submodule
- any build will use a mix of super and subproject that
  is completely untested

As a result people are basically saying avoid using submodules but I am wondering whether git can be tweaked to do the right thing by default.

I understand we can work around it by asking everyone to create a correct config, but can't we make it DTRT by default to reduce friction?

-- 
MST
Previous: Junio C HamanoNext: Glen Choo
Message 6 of 8 in “sudmodule.<name>.recurse ignored”
  1. Michael S. TsirkinOct 7, 2022
  2. Ævar Arnfjörð BjarmasonOct 7, 2022
  3. Michael S. TsirkinOct 7, 2022
  4. Glen ChooOct 7, 2022
  5. Junio C HamanoOct 7, 2022
  6. Michael S. TsirkinOct 11, 2022
  7. Glen ChooOct 12, 2022
  8. Michael S. TsirkinOct 12, 2022

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.