From: Junio C Hamano Date: Tue, 06 Jul 2021 19:39:01 GMT Subject: Re: [PATCH v4 4/6] refs: add failure_errno to refs_read_raw_ref() signature Message-ID: In-Reply-To: <9c933706cb09265b62213b29f4a632c8a4445de1.1625597757.git.gitgitgadget@gmail.com> "Han-Wen Nienhuys via GitGitGadget" writes: > -int refs_read_raw_ref(struct ref_store *ref_store, > - const char *refname, struct object_id *oid, > - struct strbuf *referent, unsigned int *type) > +int refs_read_raw_ref(struct ref_store *ref_store, const char *refname, > + struct object_id *oid, struct strbuf *referent, > + unsigned int *type, int *failure_errno) > { > - int result; > - int failure_errno; > + int ignore; > + if (failure_errno) > + *failure_errno = 0; > + else > + failure_errno = &ignore; > + Same comment as v3(v5). Squashable fix-up follows. diff --git a/refs.c b/refs.c index eca7310e7a..aaea9b34c6 100644 --- a/refs.c +++ b/refs.c @@ -1677,11 +1677,11 @@ int refs_read_raw_ref(struct ref_store *ref_store, const char *refname, struct object_id *oid, struct strbuf *referent, unsigned int *type, int *failure_errno) { - int ignore; - if (failure_errno) - *failure_errno = 0; - else - failure_errno = &ignore; + int unused_errno; + + if (!failure_errno) + failure_errno = &unused_errno; + *failure_errno = 0; if (!strcmp(refname, "FETCH_HEAD") || !strcmp(refname, "MERGE_HEAD")) { return refs_read_special_head(ref_store, refname, oid, referent,