Fix infinite loop when exploring git repos