On a fresh git repo, after adding a submodule and changing to the submodule directory most git commands fail when run within the submodule with the error:
fatal: index file open failed: Not a directory
The full set of commands to reproduce the issue:
> git init .
Initialized empty Git repository in /Users/drh/code/personal/Experiments/git-test/.git/
> git status
On branch master
Initial commit
nothing to commit (create/copy files and use "git add" to track)
> git submodule add git@github.com:mitsuhiko/flask.git thirdparty/flask
Cloning into 'thirdparty/flask'...
remote: Reusing existing pack: 9959, done.
remote: Total 9959 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (9959/9959), 5.17 MiB | 1.11 MiB/s, done.
Resolving deltas: 100% (5617/5617), done.
Checking connectivity... done.
> cd thirdparty/flask
> git status
fatal: index file open failed: Not a directory
> cat .git
gitdir: ../../.git/modules/thirdparty/flask
git version 1.8.5.2 running on Mavericks