git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] refs: don't clear oid before read_raw_ref in the debug ref backend

From
XGXinyu Ruan via GitGitGadget <gitgitgadget@gmail.com>
Date
Oct 31, 2025, 03:37 UTC
Message-ID
<pull.2089.git.git.1761881825025.gitgitgadget@gmail.com>
From: Xinyu Ruan <r200981113@gmail.com>

The debug_read_raw_ref function clears the oid to null_oid before calling read_raw_ref, which causes the oid to be lost even when read_raw_ref successfully reads the reference. This leads to failures when executing commands like "git branch new_branch <commit_id>" with GIT_TRACE_REFS=1, as the command cannot find a valid branch point because the oid is null.

Signed-off-by: Xinyu Ruan <r200981113@gmail.com>
---
    refs: don't clear oid before read_raw_ref in the debug ref backend
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2089%2FRuanXinyu%2Fref-debug-disable-clear-oid-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2089/RuanXinyu/ref-debug-disable-clear-oid-v1
Pull-Request: https://github.com/git/git/pull/2089
 refs/debug.c | 1 -
 1 file changed, 1 deletion(-)
diff --git a/refs/debug.c b/refs/debug.c
index 697adbd0dc..c8dde3558d 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -227,7 +227,6 @@ static int debug_read_raw_ref(struct ref_store *ref_store, const char *refname,
 	struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
 	int res = 0;
 
-	oidcpy(oid, null_oid(ref_store->repo->hash_algo));
 	res = drefs->refs->be->read_raw_ref(drefs->refs, refname, oid, referent,
 					    type, failure_errno);
 

base-commit: a99f379adf116d53eb11957af5bab5214915f91d
-- 
gitgitgadget
Next: Patrick Steinhardt
Message 1 of 2 in “refs: don't clear oid before read_raw_ref in the debug ref backend”
  1. refs: don't clear oid before read_raw_ref in the debug ref backendXinyu Ruan via GitGitGadget, Oct 31, 2025
  2. Patrick SteinhardtOct 31, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.