Handle more errors when trying to read a ref
Some files aren't just not there, but actually invalid. Different
operating systems handle that differently, but rather than getting
cute and specific, treat any error when reading a ref as indicating
that it's not there.
(As an example, double quotes raise one type of error on Windows;
non-UTF-8 paths another on macOS, and e.g. ZFS on Linux triggers a
third if UTF-8 is active.)
See: https://foss.heptapod.net/mercurial/hg-git/-/issues/397