Lookup a reference by its name in a repository.
The generated reference is owned by the repository and should not be freed by the user.
the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...)
0 on success; error code otherwise