Thread (14 messages) flat view 14 messages, 4 authors, 2016-06-15

Re: [PATCH] Let .git/config specify the url for submodules

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:13


On Sat, 2 Jun 2007, Sven Verdoolaege wrote:
On Fri, Jun 01, 2007 at 09:29:58AM -0700, Linus Torvalds wrote:
quoted
	[module "infrastructure"]
		submodule = lib
		submodule = build

	[submodule "lib"]
		url = git://xyzzy/lib-1.2.3

	[submodule "build"]
		url = git://xyzzy/build-0.61


IOW, in the above case, we have *three* modules:

 - module "infrastructure", that is the union of submodules/paths "lib" 
   and "build"
 - module "lib" (== submodule/path "lib")
 - module "build" (== submodule/path "build")
If there are three modules, then why is one in the "module" section
and the other two in the "submodule" section?
Because there are:

 - *two* actual submodules (== path), namely "lib" and "build".

 - each submodule always is *implicitly* a module too

 - we have a *named* (aka explicit) module "infrastructure" that is a 
   higher-level name for one or more submodules (in this case two).

So the implicit modules could have been written out:

	[module "lib"]
		submodule = "lib" 	# aka 'path = "lib"'

	 [module "build"]
		submodule = "build"	# aka 'path = "build"'

but my suggestion was that if the module name and the path name are the 
same, you don't need to say it.

(And quite frankly, I think it reads better as "submodule" than as "path", 
but maybe that threw you).
Why not allow a module to both contain smaller modules and be contained
in a bigger module?
Because the "module" definition is _different_ from the "submodule" 
definition.

The "module" definition is just a level of indirection. It is what allows 
you to call your module "kernel" regardless of where in the tree it is 
(and regardless of whether it's actually built up on *one* directory or 
many). It allows what CVS users have long used the "alias" thing for (or 
whatever it's called in CVSROOT/modules. But it also allows you to name 
single modules *without* having to specify exactly where in the tree they 
are.

In contrast, the "submodule" thing actually would declare where the 
submodule can be found from an URL standpoint. 

And maybe you want to allow the CVS "alias" kind of thing separately, but 
I think it's very common (exactly because quite often you want to cluster 
a few submodules together as "src" or "docs" or something, even if they 
might be technically more than one actual subproject).

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help