git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] refs: print errno for read_raw_ref if GIT_TRACE_REFS is set
@ 2021-04-12 19:32 Han-Wen Nienhuys via GitGitGadget
  2021-04-12 21:45 ` Junio C Hamano
  2021-04-13 12:10 ` [PATCH v2] " Han-Wen Nienhuys via GitGitGadget
  0 siblings, 2 replies; 7+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2021-04-12 19:32 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

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

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
    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

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1002%2Fhanwen%2Ferrno-debug-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1002/hanwen/errno-debug-v1
Pull-Request: https://github.com/git/git/pull/1002

 refs/debug.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/refs/debug.c b/refs/debug.c
index 922e64fa6ad9..576bf98e74ae 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;
 }

base-commit: 89b43f80a514aee58b662ad606e6352e03eaeee4
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-23  8:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 19:32 [PATCH] refs: print errno for read_raw_ref if GIT_TRACE_REFS is set Han-Wen Nienhuys via GitGitGadget
2021-04-12 21:45 ` Junio C Hamano
2021-04-13 11:58   ` Han-Wen Nienhuys
2021-04-13 12:02     ` Han-Wen Nienhuys
2021-04-13 20:08     ` Junio C Hamano
2021-04-23  8:34       ` Han-Wen Nienhuys
2021-04-13 12:10 ` [PATCH v2] " Han-Wen Nienhuys via GitGitGadget

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).