git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/5] global: drop external `the_index` variable
Date: Mon, 15 Apr 2024 16:15:02 +0200	[thread overview]
Message-ID: <Zh02ZpS8x9H7FpHJ@tanuki> (raw)
In-Reply-To: <28541f00-9054-4aa0-8e47-348043b5f863@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1959 bytes --]

On Mon, Apr 15, 2024 at 02:55:07PM +0100, Phillip Wood wrote:
> Hi Patrick
> 
> On 15/04/2024 12:42, Patrick Steinhardt wrote:
> > The motivation of these patches comes from the introduction of the ref
> > format extension. I found it really hard to reason about the state of
> > `the_repository` and would like to continue its deprecation in favor of
> > explicitly passing down a `struct repository *`. Getting rid of
> > `the_index` is a first easy step into that direction to make things more
> > self-contained.
> 
> 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 see these two things as orthogonal. Overall, the target is to have as
few global state as possible. This requires us to over time remove both
`the_repository`, but also `the_index`. Removing the latter is a ton
easier to achieve than removing the former, and so I took the easier
step first.

Whatever we do, we have to do things gradually anyway and thus we have
to start somewhere. I've already got more things in the pipeline, where
the next step for me is to touch up "refs.h" so that we always pass in
the `struct ref_store *`. And here we will be introducing more uses of
`the_repository`, as well. But I think this is okay, and by working from
the bottom up we will over time get to a state where the lower levels of
Git don't require globals anymore, whereas higher levels like e.g. the
builtins still do use them.

Eventually, we can then introduce a macro `USE_THE_REPOSITORY_VARIABLE`,
similar to `USE_THE_INDEX_VARIABLE` that I have just removed in this
patch series.

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-04-15 14:15 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 [this message]
2024-04-15 17:50   ` Junio C Hamano
2024-04-16  5:27     ` Patrick Steinhardt
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=Zh02ZpS8x9H7FpHJ@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /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).