Re: [RFC] Submodules in GIT
From: Jakub Narebski <hidden>
Date: 2016-08-11 20:43:42
Andreas Ericsson wrote:
Torgil Svensson wrote:quoted
On 12/4/06, Linus Torvalds [off-list ref] wrote:quoted
So yeah, it's a bit hacky, but for the reasons I've tried to outline, I actually think that users _want_ hacky. Exactly because "deep integration" ends up having so many _bad_ features, so it's better to have a thin and simple layer that you can actually see past if you want to.Thin and simple sounds very good. Let's try it with an example. Lets say we have one apllication App1 and three librarys (Lib1, Lib2, Lib3) with the following dependency-graph: App1 / \ / \ Lib1 Lib2 \ / \ / Lib3 (don't really needed for this example but looks nice) All components can be used individually and have their own upstream, maintainer etc. To compile App1 however, I need some files from both Lib1 and Lib2 specifying it's API. To satisfy these dependencies, It sounds reasonable to link Lib2 and Lib3 submodules from App1. In your concept, can I construct a modules file to fetch the API files and their history without checking out the whole Lib1 and Lib2 source?I think not. Then it wouldn't be a submodule anymore, but just some random sources from an upstream project. Not that it's an uncommon workflow or anything, but it's sort of akin to just importing the SHA1 implementation (a few source-files with no real interest in the history of those source-files) from openssl into a different project rather than actually using the entire openssl lib (which would be nice to have as a submodule).
Note that this is what partial checkouts (another great idea nobody implemented yet[*1*]; you can do partial checkout but there is no UI for this, and working with partial checkouts is bit hard) is about, although it would buy you only working area space, and not repository (object database storage) space. For now, you can imitate this by having in in Lib1 and Lib2 the 'includes' branch which would contain only the API (and which you would have to keep up to date with 'master', but it should be fairly easy: just merge changes into 'includes', perhaps with help of git-rerere, or [nonexisting] git-rerere2). [*1*] Although with our track[*2*] I guess it is reasonable to think it would get implemented soon. [*2*] Out of four "great ideas": shallow clone / sparse clone, submodules support, lazy clone / remote alternates, two are in example-implementation (submodules support) and beta work (shallow clone is in 'next'). -- Jakub Narebski Warsaw, Poland ShadeHawk on #git