If the git process used gitdir/worktree arguments instead of changing process directory it would be easier to debug unexpected failures because you could copy/paste the command lines anywhere. See http://stackoverflow.com/questions/1386291/git-git-dir-not-working-as-expected for advice on how to use it.