refs: make errno output explicit for refs_resolve_ref_unsafe
authorHan-Wen Nienhuys <hanwen@google.com>
Thu, 10 Jun 2021 12:57:44 +0000 (12:57 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Jun 2021 03:43:42 +0000 (12:43 +0900)
commit6445eeffc95b36946705f8698935b44954dc47df
tree172cc4a658194849f42b436ca2332013d8682dde
parent819c6d74b386ec8d308baab2278c54e0ae788a12
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>
refs.c
refs/refs-internal.h