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

Re: [PATCH] refs: dereference the value of the required pointer

From
Patrick Steinhardt <ps@pks.im>
Date
Dec 19, 2025, 06:28 UTC
Message-ID
<aUTwmSNfaoVzEIpD@pks.im>
In-Reply-To
<pull.2130.git.git.1766074249443.gitgitgadget@gmail.com>
On Thu, Dec 18, 2025 at 04:10:49PM +0000, AZero13 via GitGitGadget wrote:
Show 12 quoted lines
> diff --git a/refs/debug.c b/refs/debug.c
> index 3e31228c9a..639db0f26e 100644
> --- a/refs/debug.c
> +++ b/refs/debug.c
> @@ -139,7 +139,7 @@ static int debug_optimize_required(struct ref_store *ref_store,
>  	struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
>  	int res = drefs->refs->be->optimize_required(drefs->refs, opts, required);
>  	trace_printf_key(&trace_refs, "optimize_required: %s, res: %d\n",
> -			 required ? "yes" : "no", res);
> +			 *required ? "yes" : "no", res);
>  	return res;
>  }

Makes sense. One question is whether `required` will always be non-NULL so that we can unconditionally dereference the pointer like this. But from going through the implementations I can see that the pointer already does get dereferenced unconditionally, so this fix is safe.

Thanks!
Patrick
Previous: Karthik Nayak
Message 4 of 4 in “refs: dereference the value of the required pointer”
  1. refs: dereference the value of the required pointerAZero13 via GitGitGadget, Dec 18, 2025
  2. Junio C HamanoDec 19, 2025
  3. Karthik NayakDec 25, 2025
  4. Patrick SteinhardtDec 19, 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.