Junio C Hamano <gitster@xxxxxxxxx> writes: > Kyle Meyer <kyle@xxxxxxxxxx> writes: >> As the required update to t3700-add shows, being looser with the check >> means that we're stricter when adding empty repositories to the index: >> >> % git add repo >> warning: adding embedded git repository: repo >> hint: You've added another git repository inside your current repository. >> hint: [...] >> error: unable to index file 'repo/' >> fatal: adding files failed > > Hmph, why should we have the initial "warning" with hint? Shouldn't > the above result in an outright error? Something like: > > $ git add repo ;# or git add repo/ > error: repo does not have a commit checked out > fatal: adding files failed > > because the entire purpose of "git add repo" (or "git add repo/") when > "repo" is a repository is to register the commit that is checked out > in that sub-repository to the index of the top-level repository, as > part of updating (or starting) a submodule. Right, the hint makes no sense here. I'll look into adjusting the output to be appropriate. As a minor note: I believe your "git add repo/" comments above describe what should be and not what currently is. The trailing slash results in adding the content from the specified repository to the current repository rather than registering the repository as a submodule: $ git --version git version 2.21.0 $ git init $ git init a $ git -C a commit --allow-empty -mmsg $ touch a/f $ git add a/ $ git status -s A a/f This behavior (and fixing it) was discussed at https://public-inbox.org/git/20180618111919.GA10085@xxxxxxxxxxxxxxx