Git development
 help / color / mirror / Atom feed
From: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
To: git@vger.kernel.org
Cc: christian.couder@gmail.com, ps@pks.im,
	usmanakinyemi202@gmail.com, siddharthasthana31@gmail.com,
	kaartic.sivaraam@gmail.com, okhuomonajayi54@gmail.com
Subject: [PATCH v2 0/5] notes: start passing the repository through notes.[ch]
Date: Tue, 24 Nov 2026 18:21:41 +0100	[thread overview]
Message-ID: <20261124172146.18330-1-okhuomonajayi54@gmail.com> (raw)
In-Reply-To: <20261105203344.48513-1-okhuomonajayi54@gmail.com>

This is a preparatory series. It makes the code in notes.[c,h] and its
direct callers work on the repository stored in struct notes_tree instead
of the_repository. It deliberately does not convert the whole notes
subsystem yet; it does the bulk of the work in notes.[c,h] and leaves the
rest for future series.

What it does:
 - stores the repository in struct notes_tree;
 - uses the tree's repository when reading, writing and pruning notes;
 - passes the repository to the ref glob helpers and the combine_notes
   callbacks.

What is left for future series:
 - notes.c: the display-notes code keeps its state in globals, and log,
   format-patch, diff-tree and format-rev are given a repository but do
   not pass it on. format_note() still falls back to the global
   default_notes_tree, and expand_loose_notes_ref() only takes a strbuf.
   The hash-size helpers are also still on the global.
 - notes-utils.[c,h]: still use the_repository. And the hash-size helpers
   still on the global are reached from here, through create_notes_commit()
   -> write_notes_tree(), so converting notes-utils is tied to converting
   those helpers too.
 - notes-merge.[c,h]: still work on the global repository.

Changes since v1:
 - Dropped the final patch (notes-utils: use the given repository) so the
   series stays within notes.[c,h] and its callers, and reframed it as a
   preparatory series.
 - Moved the copy_note() change out of the combine_notes patch into the
   writing-and-pruning patch, where it belongs, and updated both commit
   messages.

Okhuomon Ajayi (5):
  notes: store the repository in struct notes_tree
  notes: use the tree's repository when reading notes
  notes: use the tree's repository when writing and pruning
  notes: pass the repository to the ref glob helpers
  notes: pass the repository to the combine_notes callbacks

 builtin/notes.c |   8 ++-
 notes-cache.c   |   3 +-
 notes-utils.c   |   9 ++-
 notes.c         | 164 ++++++++++++++++++++++++++++--------------------
 notes.h         |  40 +++++++-----
 5 files changed, 134 insertions(+), 90 deletions(-)

Range-diff against v1:
1:  79ca75340a = 1:  5ad0f1bd62 notes: store the repository in struct notes_tree
2:  9692b4f18c = 2:  1018419720 notes: use the tree's repository when reading notes
3:  f87b683aeb ! 3:  67a2942c09 notes: use the tree's repository when writing and pruning
    @@ Commit message
         the repository, passed down from the tree. prune_notes() hands
         the repository to its callback in a small struct.
     
    +    copy_note() also writes through the tree, by calling add_note(),
    +    so it uses the tree's hash algorithm for its null object ID.
    +
         Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
     
      ## notes.c ##
    @@ notes.c: int write_notes_tree(struct notes_tree *t, struct object_id *result)
      	}
      }
      
    +@@ notes.c: int copy_note(struct notes_tree *t,
    + 	if (note)
    + 		return add_note(t, to_obj, note, combine_notes);
    + 	else if (existing_note)
    +-		return add_note(t, to_obj, null_oid(the_hash_algo), combine_notes);
    ++		return add_note(t, to_obj, null_oid(t->repo->hash_algo),
    ++				combine_notes);
    + 
    + 	return 0;
    + }
4:  469aa752ab = 4:  7ea6c0e5a2 notes: pass the repository to the ref glob helpers
5:  517c056f8d ! 5:  ff8cf4d22a notes: pass the repository to the combine_notes callbacks
    @@ Commit message
         belongs to another repository. The callbacks are only called from
         note_tree_insert(), which has the tree.
     
    -    Pass the tree's repository to all combine_notes callbacks. Also make
    -    copy_note() use the tree's hash algorithm for its null object ID.
    +    Pass the tree's repository to all combine_notes callbacks.
     
         Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
     
    @@ notes.c: int combine_notes_cat_sort_uniq(struct object_id *cur_oid,
      			       buf.len, OBJ_BLOB, cur_oid);
      
      out:
    -@@ notes.c: int copy_note(struct notes_tree *t,
    - 	if (note)
    - 		return add_note(t, to_obj, note, combine_notes);
    - 	else if (existing_note)
    --		return add_note(t, to_obj, null_oid(the_hash_algo), combine_notes);
    -+		return add_note(t, to_obj, null_oid(t->repo->hash_algo),
    -+				combine_notes);
    - 
    - 	return 0;
    - }
     
      ## notes.h ##
     @@ notes.h: struct strbuf;
6:  75b58d578b < -:  ---------- notes-utils: use the given repository
-- 
2.56.0


  parent reply	other threads:[~2026-11-24 17:22 UTC|newest]

Thread overview: 86+ 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
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-24 15:28                       ` Christian Couder
2026-11-24 16:13                         ` Okhuomon Ajayi
2026-11-13 11:40                     ` Okhuomon Ajayi
2026-11-23  9:23                       ` Okhuomon Ajayi
2026-11-24 15:26                   ` Christian Couder
2026-11-24 15:49                     ` Okhuomon Ajayi
2026-11-05 20:33                 ` [Outreachy PATCH 6/6] notes-utils: use the given repository Okhuomon Ajayi
2026-11-24 17:21                 ` Okhuomon Ajayi [this message]
2026-11-24 17:21                   ` [PATCH v2 1/5] notes: store the repository in struct notes_tree Okhuomon Ajayi
2026-11-25  0:34                     ` Junio C Hamano
2026-11-25  6:39                       ` Okhuomon Ajayi
2026-11-24 17:21                   ` [PATCH v2 2/5] notes: use the tree's repository when reading notes Okhuomon Ajayi
2026-11-25  0:54                     ` Junio C Hamano
2026-11-25  6:45                       ` Okhuomon Ajayi
2026-11-25  8:25                         ` Christian Couder
2026-11-25 18:13                           ` Okhuomon Ajayi
2026-11-25 19:09                             ` Junio C Hamano
2026-11-25 20:36                               ` Okhuomon Ajayi
2026-11-25 17:50                         ` Junio C Hamano
2026-11-25 18:19                           ` Okhuomon Ajayi
2026-11-24 17:21                   ` [PATCH v2 3/5] notes: use the tree's repository when writing and pruning Okhuomon Ajayi
2026-11-25  0:54                     ` Junio C Hamano
2026-11-25  6:48                       ` Okhuomon Ajayi
2026-11-24 17:21                   ` [PATCH v2 4/5] notes: pass the repository to the ref glob helpers Okhuomon Ajayi
2026-11-25  5:12                     ` Junio C Hamano
2026-11-24 17:21                   ` [PATCH v2 5/5] notes: pass the repository to the combine_notes callbacks Okhuomon Ajayi
2026-11-24 22:50                   ` [PATCH v2 0/5] notes: start passing the repository through notes.[ch] Junio C Hamano
2026-11-25  6:24                     ` Okhuomon Ajayi
2026-11-25  1:14                   ` Junio C Hamano
2026-11-25  6:35                     ` Okhuomon Ajayi
2026-11-25 22:02                   ` [PATCH v5 0/6] " Okhuomon Ajayi
2026-11-25 22:02                     ` [PATCH v5 1/6] notes: add notes_tree_or_default() Okhuomon Ajayi
2026-11-26  2:57                       ` Junio C Hamano
2026-11-26 16:57                         ` Okhuomon Ajayi
2026-11-25 22:02                     ` [PATCH v5 2/6] notes: store the repository in struct notes_tree Okhuomon Ajayi
2026-11-26  3:17                       ` Junio C Hamano
2026-11-25 22:02                     ` [PATCH v5 3/6] notes: use the tree's repository when reading notes Okhuomon Ajayi
2026-11-26  3:37                       ` Junio C Hamano
2026-11-26 20:57                         ` Okhuomon Ajayi
2026-11-25 22:02                     ` [PATCH v5 4/6] notes: use the tree's repository when writing and pruning Okhuomon Ajayi
2026-11-25 22:02                     ` [PATCH v5 5/6] notes: pass the repository to the ref glob helpers Okhuomon Ajayi
2026-11-25 22:02                     ` [PATCH v5 6/6] notes: pass the repository to the combine_notes callbacks Okhuomon Ajayi
2026-11-26  3:57                     ` [PATCH v5 0/6] notes: start passing the repository through notes.[ch] Junio C Hamano
2026-11-26 21:07                       ` Okhuomon Ajayi
2026-11-26 21:33                   ` [PATCH v6 " Okhuomon Ajayi
2026-11-26 21:33                     ` [PATCH v6 1/6] notes: add notes_tree_or_default() Okhuomon Ajayi
2026-11-26 21:33                     ` [PATCH v6 2/6] notes: store the repository in struct notes_tree Okhuomon Ajayi
2026-11-26 21:33                     ` [PATCH v6 3/6] notes: use the tree's repository when reading notes Okhuomon Ajayi
2026-11-27 13:13                       ` Christian Couder
2026-11-26 21:33                     ` [PATCH v6 4/6] notes: use the tree's repository when writing and pruning Okhuomon Ajayi
2026-11-26 21:33                     ` [PATCH v6 5/6] notes: pass the repository to the ref glob helpers Okhuomon Ajayi
2026-11-26 21:33                     ` [PATCH v6 6/6] notes: pass the repository to the combine_notes callbacks Okhuomon Ajayi
2026-11-27 13:22                     ` [PATCH v6 0/6] notes: start passing the repository through notes.[ch] Christian Couder
2026-11-27 13:52                       ` Okhuomon Ajayi
2026-11-27 18:19                         ` Junio C Hamano
2026-11-27 22:04                     ` [PATCH v7 " Okhuomon Ajayi
2026-11-27 22:04                       ` [PATCH v7 1/6] notes: add notes_tree_or_default() Okhuomon Ajayi
2026-11-27 22:04                       ` [PATCH v7 2/6] notes: store the repository in struct notes_tree Okhuomon Ajayi
2026-11-27 22:04                       ` [PATCH v7 3/6] notes: use the tree's repository when reading notes Okhuomon Ajayi
2026-11-27 22:04                       ` [PATCH v7 4/6] notes: use the tree's repository when writing and pruning Okhuomon Ajayi
2026-11-27 22:04                       ` [PATCH v7 5/6] notes: pass the repository to the ref glob helpers Okhuomon Ajayi
2026-11-27 22:04                       ` [PATCH v7 6/6] notes: pass the repository to the combine_notes callbacks 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=20261124172146.18330-1-okhuomonajayi54@gmail.com \
    --to=okhuomonajayi54@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=ps@pks.im \
    --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