1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 05:36:10 +02:00

refs: print errno for read_raw_ref if GIT_TRACE_REFS is set

The ref backend API uses errno as a sideband error channel.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Han-Wen Nienhuys 2021-04-12 19:32:34 +00:00 committed by Junio C Hamano
parent 89b43f80a5
commit 2a2112a429

View File

@ -244,6 +244,7 @@ static int debug_read_raw_ref(struct ref_store *ref_store, const char *refname,
int res = 0;
oidcpy(oid, &null_oid);
errno = 0;
res = drefs->refs->be->read_raw_ref(drefs->refs, refname, oid, referent,
type);
@ -251,7 +252,9 @@ static int debug_read_raw_ref(struct ref_store *ref_store, const char *refname,
trace_printf_key(&trace_refs, "read_raw_ref: %s: %s (=> %s) type %x: %d\n",
refname, oid_to_hex(oid), referent->buf, *type, res);
} else {
trace_printf_key(&trace_refs, "read_raw_ref: %s: %d\n", refname, res);
trace_printf_key(&trace_refs,
"read_raw_ref: %s: %d (errno %d)\n", refname,
res, errno);
}
return res;
}