better git repo detection