Skip to content

Commit bf0d4c8

Browse files
committed
Merge branch 'hn/refs-trace-errno'
Show errno in the trace output in the error codepath that calls read_raw_ref method. * hn/refs-trace-errno: refs: print errno for read_raw_ref if GIT_TRACE_REFS is set
2 parents a1cac26 + 2a2112a commit bf0d4c8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

refs/debug.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,17 @@ static int debug_read_raw_ref(struct ref_store *ref_store, const char *refname,
244244
int res = 0;
245245

246246
oidcpy(oid, &null_oid);
247+
errno = 0;
247248
res = drefs->refs->be->read_raw_ref(drefs->refs, refname, oid, referent,
248249
type);
249250

250251
if (res == 0) {
251252
trace_printf_key(&trace_refs, "read_raw_ref: %s: %s (=> %s) type %x: %d\n",
252253
refname, oid_to_hex(oid), referent->buf, *type, res);
253254
} else {
254-
trace_printf_key(&trace_refs, "read_raw_ref: %s: %d\n", refname, res);
255+
trace_printf_key(&trace_refs,
256+
"read_raw_ref: %s: %d (errno %d)\n", refname,
257+
res, errno);
255258
}
256259
return res;
257260
}

0 commit comments

Comments
 (0)