summaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorLibravatar Han-Wen Nienhuys <hanwen@google.com>2021-04-12 19:32:34 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-04-12 14:42:37 -0700
commit2a2112a42913ee7397f950f3b8f9b3f3ab84a631 (patch)
tree0d9d7ed74da4bec58530b4ac19cde395b67338e6 /refs
parentThe eighth batch (diff)
downloadtgif-2a2112a42913ee7397f950f3b8f9b3f3ab84a631.tar.xz
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>
Diffstat (limited to 'refs')
-rw-r--r--refs/debug.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/refs/debug.c b/refs/debug.c
index 922e64fa6a..576bf98e74 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -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;
}