From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Phillip Wood <phillip.wood123@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 0/5] global: drop external `the_index` variable
Date: Tue, 16 Apr 2024 07:27:22 +0200 [thread overview]
Message-ID: <Zh4MOkyOrM8kYeiK@tanuki> (raw)
In-Reply-To: <xmqq8r1eo6pz.fsf@gitster.g>
[-- Attachment #1: Type: text/plain, Size: 2284 bytes --]
On Mon, Apr 15, 2024 at 10:50:48AM -0700, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
>
> > Maybe I've got the wrong end of the stick but my impression is that it
> > is the use of "the_repository" in library code (i.e. the files outside
> > builtin/) that causes most of the pain. With that in mind would be we
> > better focusing contributor and reviewer effort on eliminating
> > "the_repository" from those files instead? It would need to be done in
> > carefully in stages but would bring real benefits.
>
> I am afraid that it would take a much larger effort.
>
> I have a suspicion that many of the users of the_index do not have
> to even need that the index_state they work on is connected to any
> instance of a repository object (in other words, I tend to think
> that the value of having a pointer to an index_state in an instance
> of a repository structure is dubious), so in a sense, this rewrite
> of code that use the_index to use the_repository may be going in a
> wrong direction.
I wouldn't say it's going in a wrong direction. It simply makes explicit
what already is implicit and thus simplifies our ability to reason about
the code.
At least it does that for me -- if others disagree then I will rethink
my approach. But the third patch demonstrates that the current approach
also causes weird inconsistencies in how we track the state of both
`the_index` and `the_repository` in tandem.
> In other words, these functions may eventually want to take a pointer
> to an index_state structure as their parameters, without having to
> deal with the whole repository structure, but this rewrite assumes
> they would eventually want to all work with a repository structure
> when the_repository dependency is lifted. I'll need to see the
> codepaths involved more carefully and think about it.
Yes, that's something that we will have to do eventually. I simply think
that the easiest way to approach this is bottom-up by moving the level
at which we inject the index one level up at a time. And with every
level that we move up we should figure out the intent of the code so
that we can decide whether it should use a local copy, the index of the
repository or something else.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-04-16 5:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 11:42 [PATCH 0/5] global: drop external `the_index` variable Patrick Steinhardt
2024-04-15 11:42 ` [PATCH 1/5] t/helper: stop using `the_index` Patrick Steinhardt
2024-04-17 17:23 ` Karthik Nayak
2024-04-15 11:42 ` [PATCH 2/5] builtin: " Patrick Steinhardt
2024-04-17 17:32 ` Karthik Nayak
2024-04-18 12:16 ` Patrick Steinhardt
2024-04-15 11:42 ` [PATCH 3/5] repository: initialize index in `repo_init()` Patrick Steinhardt
2024-04-17 17:38 ` Karthik Nayak
2024-04-18 12:16 ` Patrick Steinhardt
2024-04-15 11:43 ` [PATCH 4/5] builtin/clone: stop using `the_index` Patrick Steinhardt
2024-04-15 11:43 ` [PATCH 5/5] repository: drop global `the_index` variable Patrick Steinhardt
2024-04-15 13:55 ` [PATCH 0/5] global: drop external " Phillip Wood
2024-04-15 14:15 ` Patrick Steinhardt
2024-04-15 17:50 ` Junio C Hamano
2024-04-16 5:27 ` Patrick Steinhardt [this message]
2024-04-17 17:40 ` Karthik Nayak
2024-04-18 12:16 ` Patrick Steinhardt
2024-04-18 12:14 ` [PATCH v2 0/6] global: drop " Patrick Steinhardt
2024-04-18 12:14 ` [PATCH v2 1/6] t/helper: stop using `the_index` Patrick Steinhardt
2024-04-18 12:14 ` [PATCH v2 2/6] builtin: " Patrick Steinhardt
2024-04-18 12:14 ` [PATCH v2 3/6] repository: initialize index in `repo_init()` Patrick Steinhardt
2024-04-18 12:14 ` [PATCH v2 4/6] builtin/clone: stop using `the_index` Patrick Steinhardt
2024-04-18 12:14 ` [PATCH v2 5/6] repository: drop `the_index` variable Patrick Steinhardt
2024-04-18 12:14 ` [PATCH v2 6/6] repository: drop `initialize_the_repository()` Patrick Steinhardt
2024-04-18 19:36 ` [PATCH v2 0/6] global: drop `the_index` variable Junio C Hamano
2024-04-19 4:25 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zh4MOkyOrM8kYeiK@tanuki \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood123@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).