On Tue, May 8, 2012 at 5:19 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Erik Faye-Lund <kusmabite@xxxxxxxxx> writes: > >> + test_create_repo empty-repo && >> + git submodule add ./empty-repo empty-submodule > > You have an empty-repo but that is not part of the superproject; the > superproject will have empty-submodule submodule which is a clone of > empty-repo. > > $ git submodule add ./empty-repo empty-submodule > Cloning into 'empty-submodule'... > warning: You appear to have cloned an empty repository. > done. > > And after that, without you doing anything in empty-submodule, that > repository already exhibits the (null) problem. Perhaps somebody, after > calling a successfull "git clone" of an empty repository (which is a silly > thing to do to begin with, with or without submodules involved, but at > least we do have a defined semantics of what happens when you do that), > tried to run "git checkout", even though there is nothing to be checked > out? The culprit in that case to suspect would be "git submodule" script. > Does it blindly assume that it can do a "git checkout" and runs that > command? Yes, it does. Basically, it calls "git checkout -f -q" from cmd_add if $branch is empty. And it fails if the checkout-call fails. I'm not saying it's a sane thing to do. But to me, it kind of feels natural to initialize the shared (i.e bare) repos for both the superproject and the submodule, clone the superproject, add the submodule, and populate these from there. But that won't work the way things currently are, because you can't "git submodule add" an empty project. To allow that, we would have to make sure "git submodule add" works with empty repositories. And we can probably archive this in multiple ways. But for now, I'm happy with just erroring out on the "git submodule add"-call. I didn't really expect adding an empty submodule to work, I was just hoping it did ;) I'm sending a proper patch with a saner test soon. -- 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