All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
Cc: git@vger.kernel.org,  christian.couder@gmail.com,
	usmanakinyemi202@gmail.com,  siddharthasthana31@gmail.com,
	kaartic.sivaraam@gmail.com
Subject: Re: [Outreachy PATCH] notes-cache: read the cache ref from the given repository
Date: Mon, 26 Oct 2026 09:57:27 -0700	[thread overview]
Message-ID: <xmqqo6cgs8lk.fsf@gitster.g> (raw)
In-Reply-To: <20261026102603.32377-1-okhuomonajayi54@gmail.com> (Okhuomon Ajayi's message of "Mon, 26 Oct 2026 11:26:03 +0100")

Okhuomon Ajayi <okhuomonajayi54@gmail.com> writes:

> 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.

      reply	other threads:[~2026-10-26 16:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 10:26 [Outreachy PATCH] notes-cache: read the cache ref from the given repository Okhuomon Ajayi
2026-10-26 16:57 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqo6cgs8lk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=okhuomonajayi54@gmail.com \
    --cc=siddharthasthana31@gmail.com \
    --cc=usmanakinyemi202@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.