On Thu, Oct 06, 2016 at 01:11:20PM -0700, Junio C Hamano wrote: > Stefan Beller <sbeller@xxxxxxxxxx> writes: > > > Currently the force flag in `git submodule add` takes care of possibly > > ignored files or when a name collision occurs. > > > > However there is another situation where submodule add comes in handy: > > When you already have a gitlink recorded, but no configuration was > > done (i.e. no .gitmodules file nor any entry in .git/config) and you > > want to generate these config entries. For this situation allow > > `git submodule add` to proceed if there is already a submodule at the > > given path in the index. Is it important that the submodule is in the index? How about worktree? >From the index entry alone we can not deduce the values anyway. So I would say the submodule has to be in the worktree, no matter what is in the index. If its not in the index we can also add it. BTW, that is the way I imagined submodules would work in the first place: just clone and add them, like I described here[1]. > > Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> > > --- > > Yup, the goal makes perfect sense. > > I vaguely recall discussing this exact issue of "git submodule add" > that refuses to add a path that already is a gitlink (via "git add" > that has previously been run) elsewhere on this list some time ago. Yes there was a discussion, see the link. Cheers Heiko [1] http://public-inbox.org/git/%3C20160916141143.GA47240@xxxxxxxxxxxxxxx%3E/