Someone on #git just encountered a problem where `git init && git add . && git status` was failing with a message about a corrupted index. error: bad index file sha1 signature fatal: index file corrupt fatal: git status --porcelain failed This confused everyone for a while, until he provided access to the directory to play with. I eventually tracked it down to a directory in the tree which already had a .git directory in it. Unfortunately, that .git repo was corrupted and was the one returning the message about a corrupted index. The problem is that the error message we were seeing did not provide any direct hints that submodules were involved or that the problem was not at the top level (`git status --porcelain` is admittedly an indirect hint to both). Here is a recipe to reproduce a similar problem: (mkdir -p z/foo; cd z/foo; git init; echo A>A; git add A; git commit -m A; cd ..; echo B>B; rm -f foo/.git/objects/*/*; git init; git add .; git status) Providing an expanded error message which clarifies that this is failing in a submodule directory makes everything clear. ---------------------------------------------------------------------- --- submodule.c~ 2011-12-02 14:25:08.000000000 -0500 +++ submodule.c 2011-12-06 14:13:00.554413432 -0500 @@ -714,7 +714,7 @@ close(cp.out); if (finish_command(&cp)) - die("git status --porcelain failed"); + die("git status --porcelain failed in submodule directory %s", path); strbuf_release(&buf); return dirty_submodule; ---------------------------------------------------------------------- Do more error messages in submodule.c need adjusting? It seems likely. -Seth Robertson -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html