Unify some vcs-finding logic between fish and shell.