Re: Mixing and matching multiple projects
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 17, 2012, 19:49 UTC
- Message-ID
- <7v39a9tf45.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <7vhayptght.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> But I wonder if we can do without forking the /s/xyzzy/os/.git submodule? > > If we *could* do this: > > cd /s/xyzzy > mkdir os/drivers/frotz && populate the directory with sources
A crucial step was missing here for my story to make *any* sense. Sorry. A step to create a repository at /s/xyzzy/os/drivers/frotz/.git must be here, like this:
(cd os/drivers/frotz && git init && git add . && git commit)
And then that is added as a submodule to the superproject.
Show 38 quoted lines
> git add os/drivers/frotz ;# to the top-level superproject!! > > to add the "frotz driver" submodule directly to the superproject, then we > could leave /s/xyzzy/os/.git intact, letting it follow the open source > world. Because the superproject must be forked in order to keep track of > what happens in the appliance that supports the "frotz" driver anyway, > this could result in the minimum amount of forking from the end user's > point of view. > > People who know the Git data structure of course can immediately see that > this is not supported (and I strongly suspect unsupportable, but my > suspicion has a history of being wrong from time to time, and that is why > I am sending this message). The index at /s/xyzzy/.git/index has to be > able to record "os" as a gitlink and "os/drivers/frotz/frotz.c" as a > regular blob at the same time, which is a D/F conflict. > > Even if you modify the index D/F conflict check to allow this, you cannot > write the top-level tree object for the superproject, as "os" needs to be > recorded as a gitlink to bind the /s/xyzzy/os/.git submodule, while you > also have to have another "os" in the same top-level tree object as a tree > object that has a single entry "drivers" (which is a tree) in it, under > which all the "os/drivers/frotz" subdirectory hang. All tree traversal > code would be very unhappy to see such a tree with "duplicate" entry, > including the unpack-trees machinery used for merging and switching > branches, connectivity machinery used for fsck, object enumeration, and > object transfer. I imagine that it *could* be done, but it won't be a > mere two-weekend hack; it has to first destroy pretty much everything in > the current codebase and rebuild it to add such a support. > > The "frotz" submodule could be added as /s/xyzzy/frotz/.git and the build > infrastructure at /s/xyzzy/.git (which we are going to fork anyway) could > be tweaked so that it creates a symbolic link in /s/xyzzy/os/drivers to > point there, pretending that there is a 'frotz' subdirectory. While that > would certainly be a workaround, I am wondering if people who have used > submodules and/or nested projects more than I have better solutions to > this puzzle. > > Comments?