Move repo-finding code to a function. Suppress errors when not in a git repo.