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

Re: [Outreachy PATCH] notes-cache: read the cache ref from the given repository

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2026, 16:57 UTC
Message-ID
<xmqqo6cgs8lk.fsf@gitster.g>
In-Reply-To
<20261026102603.32377-1-okhuomonajayi54@gmail.com>
Okhuomon Ajayi <okhuomonajayi54@gmail.com> writes:
Show 25 quoted lines
> notes_cache_match_validity() already receives the repository as
> r and uses it for the commit lookup. The ref read still used
> the_repository.
>
> Pass r to get_main_ref_store() so the validity check reads the
> ref from the same repository.
>
> Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
> ---
>  notes-cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/notes-cache.c b/notes-cache.c
> index 74cef802bd..ccc071ebd0 100644
> --- a/notes-cache.c
> +++ b/notes-cache.c
> @@ -20,7 +20,7 @@ static int notes_cache_match_validity(struct repository *r,
>  	struct strbuf msg = STRBUF_INIT;
>  	int ret;
>  
> -	if (refs_read_ref(get_main_ref_store(the_repository), ref, &oid) < 0)
> +	if (refs_read_ref(get_main_ref_store(r), ref, &oid) < 0)
>  		return 0;
>  
>  	commit = lookup_commit_reference_gently(r, &oid, 1);

This is straightforward. The function does not seem to call any function that implicitly relies on 'the_repository' either, making this a trivial improvement.

Thanks.
Previous: Okhuomon Ajayi
Message 2 of 2 in “notes-cache: read the cache ref from the given repository”
  1. notes-cache: read the cache ref from the given repositoryOkhuomon Ajayi, Oct 26, 2026
  2. Junio C HamanoOct 26, 2026

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.