From: Phillip Wood <phillip.wood123@gmail.com>
To: Patrick Steinhardt <ps@pks.im>, Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ayush Chandekar <ayu.chandekar@gmail.com>
Subject: Re: [PATCH 17/19] environment: move compression level into repo settings
Date: Tue, 15 Jul 2025 16:51:32 +0100 [thread overview]
Message-ID: <f6479d6a-32a4-4a49-a75c-589978cb9a57@gmail.com> (raw)
In-Reply-To: <aHY7LYHqVj-ECf_z@pks.im>
Hi Patrick
On 15/07/2025 12:27, Patrick Steinhardt wrote:
> On Fri, Jul 11, 2025 at 11:55:27AM -0700, Junio C Hamano wrote:
>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>
>>> I do not think adding prepare_repo_settings() calls all over the place
>>> is a good way forward as it makes it very easy to introduce
>>> regressions like this. Our builtin commands parse the config at
>>> startup for good reasons if we're going to move settings out of
>>> git_default_core_config() we should ensure that they are still parsed
>>> at startup.
>>
>> I think that is a good guideline that applies not just to this
>> series but to other topics that attempt to move globals to a member
>> in struct repository (or repository_settings)
>
> So... the only real solution that I can think about right now is to
> start parsing the repository configuration whenever we instantiate any
> repository. E.g., something like the below patch. This has the effect
> that the repo settings would always be populated when we have a
> repository at hand. Consequently, we wouldn't need to clutter those
> `prepare_repo_settings()` calls everywhere anymore.
>
> But there is a big question: what do we do with invalid configuration
> then? Do we want to die immediately when we see such command? The answer
> is probably going to be a solid "sometimes":
>
> - Some commands must function even with an invalid configuration. At
> the very least git-config(1) needs to handle this alright, as
> otherwise it might be impossible to unset/change invalid
> configuration. There may be other such examples.
That's a good point.
> - Not all configuration is equal. It may be perfectly fine to ignore
> some configuration, but other configuration may very much be mission
> critical. And whether or not configuration is important isn't really
> something we can decide, as it will depend on the specific use case.
>
> So I'm afraid that there just isn't a perfect solution here. Does it
> make sense to die due to a config key that isn't even used by a specific
> command? Maybe. And if not, which config keys _should_ make us die in
> case they are invalid?
>
> The overall situation right now is a proper mess: we have config parsing
> cluttered everywhere, and the behaviour is just plain inconsistent. Some
> parsing is delayed, some isn't.
Indeed. My objection here was that we were delaying the parsing when it
wasn't delayed before. Is it feasible to call prepare_repo_settings() in
repo_config()? That would at least avoid the problem that moving config
settings into `struct repo_settings` changes when the settings are
parsed unless the command calls prepare_repo_settings() at start up. As
far as I remember `git config` uses config_with_options() so that would
not be adversely affected by such a change.
> Some is per-repo, some is last-one-wins.
> Some config keys will cause us to die in case they are misconfigured,
> some will just be ignored.
>
> So where do we want to end up?
>
> My dream would be that all configuration were to be defined in one
> central place. The configuration should be typed, there should be
> verification for each value configured by the user.
Being able to verify config settings when they're set would be a great
improvement but we're a long way from being able to do that.
> All configuration
> gets parsed into a structure, and it can be parsed either via a
> repository (in which case we take into account its local config), or
> only via the global- and system-wide configuration. The whole config
> needs to be parsed at startup so that issues like the reported one don't
> happen where a subprocess that uses more config keys than the parent
> process dies because one of the extra keys is misconfigured.
>
> But I very much feel like this is a pipe dream right now. We already are
> working on multiple fronts to modernize the code base, and I don't quite
> feel like opening up _another_ large transformation right now.
I agree with this
> So I don't quite know what to do while we're not there yet. Without this
> large refactoring, all approaches feel like they aren't a perfect fit to
> address the bigger issue.
I agree addressing all the shortcomings you've outlined would require a
lot of refactoring. If we can find a way to avoid introducing anymore
shortcomings as we migrate away from global variables that would be a
good start.
Thanks
Phillip
next prev parent reply other threads:[~2025-07-15 15:51 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 11:17 [PATCH 00/19] object-file: get rid of `the_repository` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 01/19] object-file: fix -Wsign-compare warnings Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 02/19] object-file: stop using `the_hash_algo` Patrick Steinhardt
2025-07-11 9:52 ` Karthik Nayak
2025-07-09 11:17 ` [PATCH 03/19] object-file: get rid of `the_repository` in `has_loose_object()` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 04/19] object-file: inline `check_and_freshen()` functions Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 05/19] object-file: get rid of `the_repository` when freshening objects Patrick Steinhardt
2025-07-11 9:59 ` Karthik Nayak
2025-07-09 11:17 ` [PATCH 06/19] object-file: get rid of `the_repository` in `loose_object_info()` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 07/19] object-file: get rid of `the_repository` in `finalize_object_file()` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 08/19] loose: write loose objects map via their source Patrick Steinhardt
2025-07-11 10:25 ` Karthik Nayak
2025-07-15 10:50 ` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 09/19] odb: introduce `odb_write_object()` Patrick Steinhardt
2025-07-10 18:39 ` Toon Claes
2025-07-15 10:50 ` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 10/19] object-file: get rid of `the_repository` when writing objects Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 11/19] object-file: inline `for_each_loose_file_in_objdir_buf()` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 12/19] object-file: remove declaration for `for_each_file_in_obj_subdir()` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 13/19] object-file: get rid of `the_repository` in loose object iterators Patrick Steinhardt
2025-07-10 18:41 ` Toon Claes
2025-07-09 11:17 ` [PATCH 14/19] object-file: get rid of `the_repository` in `read_loose_object()` Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 15/19] object-file: get rid of `the_repository` in `force_object_loose()` Patrick Steinhardt
2025-07-10 18:42 ` Toon Claes
2025-07-11 10:38 ` Karthik Nayak
2025-07-15 10:50 ` Patrick Steinhardt
2025-07-15 11:36 ` Toon Claes
2025-07-09 11:17 ` [PATCH 16/19] object-file: get rid of `the_repository` in index-related functions Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 17/19] environment: move compression level into repo settings Patrick Steinhardt
2025-07-09 15:26 ` Phillip Wood
2025-07-11 18:55 ` Junio C Hamano
2025-07-15 10:50 ` Patrick Steinhardt
2025-07-15 11:27 ` Patrick Steinhardt
2025-07-15 15:51 ` Phillip Wood [this message]
2025-07-15 16:12 ` Patrick Steinhardt
2025-07-16 12:56 ` Patrick Steinhardt
2025-07-17 15:19 ` Phillip Wood
2025-07-17 15:56 ` Junio C Hamano
2025-07-15 18:50 ` Junio C Hamano
2025-07-17 8:00 ` Ayush Chandekar
2025-07-09 11:17 ` [PATCH 18/19] environment: move object creation mode " Patrick Steinhardt
2025-07-09 11:17 ` [PATCH 19/19] object-file: drop USE_THE_REPOSITORY_VARIABLE Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 00/16] object-file: get rid of `the_repository` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 01/16] object-file: fix -Wsign-compare warnings Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 02/16] object-file: stop using `the_hash_algo` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 03/16] object-file: get rid of `the_repository` in `has_loose_object()` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 04/16] object-file: inline `check_and_freshen()` functions Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 05/16] object-file: get rid of `the_repository` when freshening objects Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 06/16] object-file: get rid of `the_repository` in `loose_object_info()` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 07/16] object-file: get rid of `the_repository` in `finalize_object_file()` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 08/16] loose: write loose objects map via their source Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 09/16] odb: introduce `odb_write_object()` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 10/16] object-file: get rid of `the_repository` when writing objects Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 11/16] object-file: inline `for_each_loose_file_in_objdir_buf()` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 12/16] object-file: remove declaration for `for_each_file_in_obj_subdir()` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 13/16] object-file: get rid of `the_repository` in loose object iterators Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 14/16] object-file: get rid of `the_repository` in `read_loose_object()` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 15/16] object-file: get rid of `the_repository` in `force_object_loose()` Patrick Steinhardt
2025-07-17 4:56 ` [PATCH v2 16/16] object-file: get rid of `the_repository` in index-related functions 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=f6479d6a-32a4-4a49-a75c-589978cb9a57@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=ayu.chandekar@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
/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;
as well as URLs for NNTP newsgroup(s).