On Tue, Aug 23, 2016 at 10:47 AM, Stefan Beller <sbel...@google.com> wrote: > On Tue, Aug 23, 2016 at 10:25 AM, Junio C Hamano <gits...@pobox.com> wrote: >> I am not so sure about that. If there is an existing place that is >> buggy, shouldn't we fix that, instead of spreading the same bug >> (assuming that it is a bug in the first place, which I do not have a >> strong opinion on, at least not yet)? >> >> Can there be .git/modules/<foo>/ repository that is pointed at an >> in-tree .git file when there is no "name" defined? > > If you're holding it wrong we can come into that state. > * Checkout the submodule, > * then remove .gitmodules as well as relevant config in .git/config. > Result: Then we have a only a gitlink recorded as well as connected > working tree to a gitdir inside a superprojects .git/modules/. >
Yea, but I think you're right that we shouldn't support that state. What I'm worried about is the case where we can get this state doing something sane/acceptable but I don't think we can. So we should support the gitlink to a repository stored at <path> without stuff inside the .git/modules, and we should support submodule gitlinks with a proper .gitmodules setup. I don't think we should die() but we should error properly so I will introduce a _gently() variant of these functions, and die properly in the regular flow. >> I thought we >> errored out in module_name helper function in git-submodule.sh when >> we need a name and only have path (I just checked in the maint-2.6 >> track); did we break it recently? submodule--helper.c::module_name() >> seems to error out when submodule_from_path() fails to find one and >> will segfault if it does not have name, so it is not likely. > > The name is literally the only thing that is not optional in a struct > submodule > (see submodule-config.c:182 In lookup_or_create_by_name, these structs are > added to the internal cache. > > Stepping back a bit, I think we'd want to document this expectation more > in the man pages > The name unlike the path of a submodule must not be changed (as the > name is used internally to point at the submodules git dir) Agreed, this should be documented. Do you mind doing the documentation patch for this? Thanks, Jake -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html