get_sha1_basic(): try refs/... and finally refs/remotes/$foo/HEAD