Ignore dirty submodules

I have cherry picked this very useful patch so that we can merge it earlier that other ongoing work.