From: Patrick Steinhardt <ps@pks.im>
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, gitster@pobox.com,
karthik.188@gmail.com
Subject: Re: [Outreachy PATCH 1/6] notes: store the repository in struct notes_tree
Date: Mon, 9 Nov 2026 10:18:25 +0100 [thread overview]
Message-ID: <avGP1YMrzFKIIsU1@pks.im> (raw)
In-Reply-To: <20261105203344.48513-2-okhuomonajayi54@gmail.com>
On Thu, Nov 05, 2026 at 09:33:39PM +0100, Okhuomon Ajayi wrote:
> diff --git a/notes.c b/notes.c
> index ec9c2cb150..4ab3d45d7c 100644
> --- a/notes.c
> +++ b/notes.c
> @@ -1012,8 +1012,9 @@ char *default_notes_ref(struct repository *repo)
> return notes_ref;
> }
>
> -void init_notes(struct notes_tree *t, const char *notes_ref,
> - combine_notes_fn combine_notes, int flags)
> +void init_notes(struct repository *r, struct notes_tree *t,
> + const char *notes_ref, combine_notes_fn combine_notes,
> + int flags)
> {
> struct object_id oid, object_oid;
> unsigned short mode;
I think this function should continue to receive `struct notes_tree` as
first parameter, as this is the subsystem it belongs to. While at it,
and as we already have to adjust all callers anyway, we might rename the
function to `notes_tree_init()`.
> @@ -1057,7 +1059,8 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
> free(to_free);
> }
>
> -struct notes_tree **load_notes_trees(struct string_list *refs, int flags)
> +struct notes_tree **load_notes_trees(struct repository *r,
> + struct string_list *refs, int flags)
> {
> struct string_list_item *item;
> int counter = 0;
Okay, here the arguments make sense. We could likewise rename to
`notes_tree_load()` though.
> diff --git a/notes.h b/notes.h
> index 6dc6d7b265..0f50020816 100644
> --- a/notes.h
> +++ b/notes.h
> @@ -50,6 +50,7 @@ int combine_notes_cat_sort_uniq(struct object_id *cur_oid,
> * simultaneously.
> */
> extern struct notes_tree {
> + struct repository *repo;
> struct int_node *root;
> struct non_note *first_non_note, *prev_non_note;
> char *ref;
Oof, this interface is cursed, it really should be refactored to not
have implicit global state. Arguably, this default notes tree should be
either dropped, or it should be stored as part of a repository.
Anyway, as far as I can see we always initialize this default notes tree
via `init_notes()`. So it's cursed, but I think it should at least be
correct.
Patrick
next prev parent reply other threads:[~2026-11-09 9:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 10:45 [Outreachy PATCH] notes-utils: use the passed repository for notes refs Okhuomon Ajayi
2026-11-02 11:01 ` Patrick Steinhardt
2026-11-02 11:10 ` Okhuomon Ajayi
2026-11-03 8:49 ` [Outreachy PATCH v2 0/2] notes-utils: stop using the_repository Okhuomon Ajayi
2026-11-03 8:49 ` [Outreachy PATCH v2 1/2] notes-utils: use the passed repository for notes refs Okhuomon Ajayi
2026-11-03 9:45 ` Karthik Nayak
2026-11-03 18:01 ` Junio C Hamano
2026-11-05 7:43 ` [Outreachy PATCH] notes-utils: hide functions that still need the_repository Okhuomon Ajayi
2026-11-05 14:22 ` Patrick Steinhardt
2026-11-05 14:47 ` Okhuomon Ajayi
2026-11-05 17:56 ` Junio C Hamano
2026-11-05 20:33 ` [Outreachy PATCH 0/6] notes: use the repository stored in the notes tree Okhuomon Ajayi
2026-11-05 20:33 ` [Outreachy PATCH 1/6] notes: store the repository in struct notes_tree Okhuomon Ajayi
2026-11-09 9:18 ` Patrick Steinhardt [this message]
2026-11-09 10:27 ` Okhuomon Ajayi
2026-11-05 20:33 ` [Outreachy PATCH 2/6] notes: use the tree's repository when reading notes Okhuomon Ajayi
2026-11-05 20:33 ` [Outreachy PATCH 3/6] notes: use the tree's repository when writing and pruning Okhuomon Ajayi
2026-11-05 20:33 ` [Outreachy PATCH 4/6] notes: pass the repository to the ref glob helpers Okhuomon Ajayi
2026-11-05 20:33 ` [Outreachy PATCH 5/6] notes: pass the repository to the combine_notes callbacks Okhuomon Ajayi
2026-11-09 9:18 ` Patrick Steinhardt
2026-11-09 10:11 ` Okhuomon Ajayi
2026-11-05 20:33 ` [Outreachy PATCH 6/6] notes-utils: use the given repository Okhuomon Ajayi
2026-11-03 8:49 ` [Outreachy PATCH v2 2/2] notes-utils: pass the repository to init_copy_notes_for_rewrite() Okhuomon Ajayi
2026-11-03 9:48 ` [Outreachy PATCH v2 0/2] notes-utils: stop using the_repository Karthik Nayak
2026-11-03 10:27 ` Patrick Steinhardt
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=avGP1YMrzFKIIsU1@pks.im \
--to=ps@pks.im \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kaartic.sivaraam@gmail.com \
--cc=karthik.188@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox