Make cwd detection work when repo dir is a symlink