Git development
 help / color / mirror / Atom feed
* [Outreachy PATCH] notes-cache: read the cache ref from the given repository
@ 2026-10-26 10:26 Okhuomon Ajayi
  2026-10-26 16:57 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Okhuomon Ajayi @ 2026-10-26 10:26 UTC (permalink / raw)
  To: git
  Cc: christian.couder, usmanakinyemi202, siddharthasthana31,
	kaartic.sivaraam, Okhuomon Ajayi

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);

base-commit: 7e34d8174dcda3435d1404c9a30bef46afe6c13e
-- 
2.56.0


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

* Re: [Outreachy PATCH] notes-cache: read the cache ref from the given repository
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2026-10-26 16:57 UTC (permalink / raw)
  To: Okhuomon Ajayi
  Cc: git, christian.couder, usmanakinyemi202, siddharthasthana31,
	kaartic.sivaraam

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.

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

end of thread, other threads:[~2026-10-26 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox