Stefan Beller <sbeller@xxxxxxxxxx> writes: >> but if we already have a submodule with that name (the most likely >> explanation for its existence is because it started its life there >> and then later moved), and the submodule is bound to a different >> path, then that is a different submodule. Skipping and warning both >> are sensible thing to do. > > Skipping and warning is sensible once we decide to go this way. > > I propose to take a step back and not throw away the information > whether the given string is a name or path, as then we do not have > to warn&skip, but we can treat both correctly. Now either one of us is utterly confused, and I suspect it is me, as I do not see how "treat both correctly" could possibly work in the case this code warns and skips. At this point in the flow, we already know that it is not name, because we asked and got a "Nah, there is no submodule registered in .gitmodules at that path" from submodule_from_path(). Then we ask submodule_from_name() if there is any submodule registered under the name it would have got if it were added there, and we indeed find one. And that is definitely *not* a submodule we are looking for, because if it were, its .path would have pointed at the path we were using to ask in the first place. The one we originally found at path and are interested in finding out the details is not known to .gitmodules, and the one under that name is not the one that we are intereted in, so fetching from the repository the other one that happens to have the same name but is different from the submodule we are interested in would simply be wrong. If we only have path without any .gitmodules entry (hence there is not even URL), how would we proceed from that point on?