Fix git status hang, improve its performance