Git development
 help / color / mirror / Atom feed
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, karthik.188@gmail.com,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [Outreachy PATCH] notes-utils: hide functions that still need the_repository
Date: Thu, 5 Nov 2026 15:22:18 +0100	[thread overview]
Message-ID: <auyRGpaHb5rdVP0d@pks.im> (raw)
In-Reply-To: <20261105074333.16756-1-okhuomonajayi54@gmail.com>

On Thu, Nov 05, 2026 at 08:43:33AM +0100, Okhuomon Ajayi wrote:
> The helpers declared in notes-utils.h call into notes.c, which
> still only works on the_repository. write_notes_tree() writes
> its tree into the_repository->objects.
> 
> Passing a repository argument does not make these helpers work
> on another repository yet. Guard them with
> USE_THE_REPOSITORY_VARIABLE, as environment.h and repository.h
> do, so code that has dropped the global cannot call them by
> mistake.
> 
> Suggested-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
> ---
> This replaces my notes-utils series [1], which I'm dropping after
> Junio pointed out that the functions underneath, in notes.c, still
> only work on the_repository.
> 
> The guard also hides the enum and struct that notes-merge.h uses.
> All current users define USE_THE_REPOSITORY_VARIABLE, so nothing
> breaks today.

Hmm. Wouldn't the better course of actions be to instead fix "notes.c"?
It feels a bit weird to me to just make the whole header a pointless
include, and we don't do that for other headers, either. We have tons of
subsystems that still depend on `the_repository`, so what makes
"notes-utils.h" so special that we need to drop all of its functions?

What we indeed do sometimes is to mark some very small subset of
functions in a header as depending on `the_repository` in case the blast
radius of fixing all users is simply too big to do it in a single patch
series.

So I'm not sure whether this patch goes into a sensible direction.

Patrick

  reply	other threads:[~2026-11-05 14:22 UTC|newest]

Thread overview: 14+ 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 [this message]
2026-11-05 14:47             ` Okhuomon Ajayi
2026-11-05 17:56             ` Junio C Hamano
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=auyRGpaHb5rdVP0d@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