On Fri, May 18, 2007 at 08:59:48PM -0700, Junio C Hamano wrote: > Now, suppose "git checkout" needs to recurse into one > subdirectory that is to have a subproject. There are three > cases: > > (1) There is no git repository yet (the plumbing layer already > makes sure there is a directory, but does not do anything > else). > > (2) There already is a git repository there, which is the > correct repository (perhaps determined by .gitmodules and > .git/config in the superproject, or presense of the commit > that is recorded in the superproject's index). > > (3) There is a git repository but it is not the correct one. > > We've discussed in the other thread about what to do in case > (1) to some degree. > > For case (2), I think what should happen there is an equivalent > of this: > > $ commit=$(git-rev-parse :subproject) > $ cd subproject > $ git-rev-parse --verify $commit || git fetch || barf > $ git checkout $commit Does everyone agree that we should fetch (possibly after asking for confirmation from the use) _during_ the checkout ? I now only fetch submodules during a fetch of the supermodule (actually, in my current patch set, I only fetch a submodule the first time I see it, but that's a bug), but if there is a consensus on this, I can switch to fetching during checkout. As to the key to use to lookup the URL in the config, right now I simply use the directory name where it is attached (which seems like a useful default to me). I'm not all that convinced that we should store a default URL in history, so AFAICS, the only thing we need to store is a mapping between directory names and subproject names. It has been suggested to do that in .gitattributes. Is that OK for everyone, or do we really need a separate .gitmodules ? skimo - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html