From: Han-Wen Nienhuys <hanwen@xxxxxxxxxx> This is done in a separate commit, to pinpoint the precise cause should there be regressions in error reporting. Signed-off-by: Han-Wen Nienhuys <hanwen@xxxxxxxxxx> --- refs.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 08f69e2a16f6..6e746cb01f24 100644 --- a/refs.c +++ b/refs.c @@ -1685,10 +1685,11 @@ int refs_read_raw_ref(struct ref_store *ref_store, const char *refname, } /* This function needs to return a meaningful errno on failure */ -const char *refs_resolve_ref_unsafe(struct ref_store *refs, - const char *refname, - int resolve_flags, - struct object_id *oid, int *flags) +static const char *refs_resolve_ref_unsafe_errno(struct ref_store *refs, + const char *refname, + int resolve_flags, + struct object_id *oid, + int *flags) { static struct strbuf sb_refname = STRBUF_INIT; struct object_id unused_oid; @@ -1777,14 +1778,24 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs, return NULL; } +const char *refs_resolve_ref_unsafe(struct ref_store *refs, const char *refname, + int resolve_flags, struct object_id *oid, + int *flags) +{ + const char *result = refs_resolve_ref_unsafe_errno( + refs, refname, resolve_flags, oid, flags); + errno = 0; + return result; +} + const char *refs_resolve_ref_unsafe_with_errno(struct ref_store *refs, const char *refname, int resolve_flags, struct object_id *oid, int *flags, int *failure_errno) { - const char *result = refs_resolve_ref_unsafe(refs, refname, - resolve_flags, oid, flags); + const char *result = refs_resolve_ref_unsafe_errno( + refs, refname, resolve_flags, oid, flags); *failure_errno = errno; return result; } -- gitgitgadget