Handle submodules; work in temporary directory.