refs: make errno output explicit for refs_resolve_ref_unsafe
This introduces refs_resolve_ref_unsafe_with_errno(), which makes the API
contract for the errno output explicit. The implementation still relies on
the global errno variable to ensure no side effects of this refactoring.
In a follow-on commits, we will
* migrate callers that need this error information
* clear errno in refs_resolve_ref_unsafe() to make sure these other callers
aren't using the error output accidentally.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>