Re: [PATCH v4 4/6] refs: add failure_errno to refs_read_raw_ref() signature
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 15 quoted lines
> -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,