I have had nothing but headaches with leaveDotGit = true. Every once in a while I would get a random hash mismatch, which eventually got so annoying that I submitted a patch to the upstream repo to make the build independent of Git.
leaveDotGit = true
See also this GitHub issue: