> @@ -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) So a third function (refs_resolve_ref_unsafe_errno() - not to be confused with refs_resolve_ref_unsafe_with_errno(), which has an extra "with")? Couldn't we just swap the other 2 functions directly instead of going through this intermediary? > +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; > +} This is the errno = 0 part that I was talking about in my review of patch 4.