From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Usman Akinyemi <usmanakinyemi202@gmail.com>,
Okhuomon Ajayi <okhuomonajayi54@gmail.com>,
git@vger.kernel.org, christian.couder@gmail.com,
siddharthasthana31@gmail.com, kaartic.sivaraam@gmail.com
Subject: Re: [Outreachy PATCH] merge: stop using the_repository
Date: Mon, 9 Nov 2026 09:17:42 +0100 [thread overview]
Message-ID: <avGBpifgkHQ4L6WZ@pks.im> (raw)
In-Reply-To: <xmqq33tdcuub.fsf@gitster.g>
On Fri, Nov 06, 2026 at 05:07:40PM -0800, Junio C Hamano wrote:
> Usman Akinyemi <usmanakinyemi202@gmail.com> writes:
>
> >> merge.c | 16 +++++++---------
> >> 1 file changed, 7 insertions(+), 9 deletions(-)
> >
> >> + strvec_push(&cmd.args, merge_argument(r, j->item));
> >> strvec_push(&cmd.args, "--");
> >> strvec_push(&cmd.args, head_arg);
> >> for (j = remotes; j; j = j->next)
> >> - strvec_push(&cmd.args, merge_argument(j->item));
> >> + strvec_push(&cmd.args, merge_argument(r, j->item));
> >>
> >> cmd.git_cmd = 1;
> >> ret = run_command(&cmd);
> >> @@ -68,18 +66,18 @@ int checkout_fast_forward(struct repository *r,
> >> memset(&trees, 0, sizeof(trees));
> >> memset(&t, 0, sizeof(t));
> >> }
> >> for (i = 0; i < nr_trees; i++) {
> >> - if (repo_parse_tree(the_repository, trees[i]) < 0) {
> >> + if (repo_parse_tree(r, trees[i]) < 0) {
> >> rollback_lock_file(&lock_file);
> >> return -1;
> >> }
>
> This shows one thing that I really hate about the current
> USE_THE_REPOSITORY model.
>
> This function still calls unpack_trees(), which explicitly refers to
> and depends on the_repository. It is somewhat misleading to claim
> that merge.c no longer depends on the_repository because of that.
> Even if you pass an arbitrary repository to checkout_fast_forward(),
> the call would not work as intended because unpack_trees() called by
> it will only work with the_repository under the hood.
>
> Yet, this file now compiles without USE_THE_REPOSITORY defined,
> giving a false sense of achievement.
It _is_ an achievement. That achievement isn't that this file is now
properly libified and that it can be used with an arbitrary repo.
Because even if the subsystem didn't reference `the_repository` at all
anymore, "libification" to me isn't only about that but also about
having a sane API.
But it is an achievement because we have one less file to worry about
with regards to our end goal of getting rid of `the_repository`, and
this file cannot grow new explicit references to it.
[snip]
> Again, that is why I really hate the USE_THE_REPOSITORY macro. It
> does not help us measure our progress incrementally. Perhaps we
> could hide certain symbols from their header files (like the
> functions I converted in this demonstration patch to rid them of
> the_repository dependency) for those who do not define the macro,
> so we can get a more accurate picture of our progress. However,
> an earlier attempt to do exactly that on notes-utils.h in
> https://lore.kernel.org/git/xmqqjymt94l3.fsf@gitster.g/ was shot
> down by Patrick, so I am not sure what a good direction would be
> to provide a real incremental progress indicator.
The thing is that no matter what, unless we now start to hide every
single symbol that implicitly references `the_repository`, it will be
an imperfect measure anyway. And sure, in a perfect world we'd do
exactly that. But it would result in a ton of churn, and I don't think
it's easy to get right.
So from my perspective, the best direction here is "forward", because
the problem will solve itself automatically once libgit.a does not use
`the_repository` at all anymore.
Patrick
next prev parent reply other threads:[~2026-11-09 8:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 14:25 [Outreachy PATCH] merge: stop using the_repository Okhuomon Ajayi
2026-10-15 16:59 ` Usman Akinyemi
2026-10-15 17:20 ` Okhuomon Ajayi
2026-11-07 1:07 ` Junio C Hamano
2026-11-09 8:17 ` Patrick Steinhardt [this message]
2026-10-15 19:20 ` Junio C Hamano
2026-10-15 19:56 ` Okhuomon Ajayi
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=avGBpifgkHQ4L6WZ@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=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