#729930 'git add' within uninitialized submodule message is confusing

Package:
git
Source:
git
Description:
fast, scalable, distributed revision control system
Submitter:
Jonathan Nieder
Date:
2013-11-19 00:45:06 UTC
Severity:
minor
#729930#5
Date:
2013-11-19 00:43:26 UTC
From:
To:
Suppose I run

  git clone https://gerrit.googlesource.com/gerrit
  cd gerrit
  git checkout 5cf89bc928f2efe08d2ab6c29d0ef5a717aac8ac
  echo hi >plugins/commit-message-length-validator/greeting
  cd plugins/commit-message-length-validator

and then (a)

  git add .

or (b)

  git add *

In case (a), "git add" exits with zero status, nothing is added, and
there is no message.  In case (b), I get

  fatal: Path 'plugins/commit-message-length-validator/greeting' is \
  in submodule 'plugins/commit-message-length-validator'

I would have expected something like

  fatal: submodule 'plugins/commit-message-length-validator' is not \
  populated so I cannot add 'greeting' there

Reported by Pilif12p on #git, analysis by m0viefreak.