git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 17/19] environment: move compression level into repo settings

From
Ayush Chandekar <ayu.chandekar@gmail.com>
Date
Jul 17, 2025, 08:00 UTC
Message-ID
<CAE7as+Z7b-cpn8=kjP=bQHkiRnLd8XYe9b8_50KYcg4ea7sASQ@mail.gmail.com>
In-Reply-To
<f6479d6a-32a4-4a49-a75c-589978cb9a57@gmail.com>
On Tue, Jul 15, 2025 at 9:21 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 58 quoted lines
>
> 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.()
>
This is exactly what came to my mind too while reading Patrick's message.

As the global variables which were shifted to `struct repo_settings` were once parsed by repo_config(), we would have no problem calling prepare_repo_settings() inside it as the behaviour would be the same as before, and it checks if the repository is null too.

Show 40 quoted lines
> > 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
>
Previous: Junio C HamanoNext: Patrick Steinhardt
Message 40 of 60 in “object-file: get rid of `the_repository`”
  1. 00/19 object-file: get rid of `the_repository`Patrick Steinhardt, Jul 9, 2025
  2. 01/19 object-file: fix -Wsign-compare warningsPatrick Steinhardt, Jul 9, 2025
  3. 02/19 object-file: stop using `the_hash_algo`Patrick Steinhardt, Jul 9, 2025
  4. Karthik NayakJul 11, 2025
  5. 03/19 object-file: get rid of `the_repository` in `has_loose_object()`Patrick Steinhardt, Jul 9, 2025
  6. 04/19 object-file: inline `check_and_freshen()` functionsPatrick Steinhardt, Jul 9, 2025
  7. 05/19 object-file: get rid of `the_repository` when freshening objectsPatrick Steinhardt, Jul 9, 2025
  8. Karthik NayakJul 11, 2025
  9. 06/19 object-file: get rid of `the_repository` in `loose_object_info()`Patrick Steinhardt, Jul 9, 2025
  10. 07/19 object-file: get rid of `the_repository` in `finalize_object_file()`Patrick Steinhardt, Jul 9, 2025
  11. 08/19 loose: write loose objects map via their sourcePatrick Steinhardt, Jul 9, 2025
  12. Karthik NayakJul 11, 2025
  13. Patrick SteinhardtJul 15, 2025
  14. 09/19 odb: introduce `odb_write_object()`Patrick Steinhardt, Jul 9, 2025
  15. Toon ClaesJul 10, 2025
  16. Patrick SteinhardtJul 15, 2025
  17. 10/19 object-file: get rid of `the_repository` when writing objectsPatrick Steinhardt, Jul 9, 2025
  18. 11/19 object-file: inline `for_each_loose_file_in_objdir_buf()`Patrick Steinhardt, Jul 9, 2025
  19. 12/19 object-file: remove declaration for `for_each_file_in_obj_subdir()`Patrick Steinhardt, Jul 9, 2025
  20. 13/19 object-file: get rid of `the_repository` in loose object iteratorsPatrick Steinhardt, Jul 9, 2025
  21. Toon ClaesJul 10, 2025
  22. 14/19 object-file: get rid of `the_repository` in `read_loose_object()`Patrick Steinhardt, Jul 9, 2025
  23. 15/19 object-file: get rid of `the_repository` in `force_object_loose()`Patrick Steinhardt, Jul 9, 2025
  24. Toon ClaesJul 10, 2025
  25. Karthik NayakJul 11, 2025
  26. Patrick SteinhardtJul 15, 2025
  27. Toon ClaesJul 15, 2025
  28. 16/19 object-file: get rid of `the_repository` in index-related functionsPatrick Steinhardt, Jul 9, 2025
  29. 17/19 environment: move compression level into repo settingsPatrick Steinhardt, Jul 9, 2025
  30. Phillip WoodJul 9, 2025
  31. Junio C HamanoJul 11, 2025
  32. Patrick SteinhardtJul 15, 2025
  33. Patrick SteinhardtJul 15, 2025
  34. Phillip WoodJul 15, 2025
  35. Patrick SteinhardtJul 15, 2025
  36. Patrick SteinhardtJul 16, 2025
  37. Phillip WoodJul 17, 2025
  38. Junio C HamanoJul 17, 2025
  39. Junio C HamanoJul 15, 2025
  40. Ayush ChandekarJul 17, 2025
  41. 18/19 environment: move object creation mode into repo settingsPatrick Steinhardt, Jul 9, 2025
  42. 19/19 object-file: drop USE_THE_REPOSITORY_VARIABLEPatrick Steinhardt, Jul 9, 2025
  43. 00/16 object-file: get rid of `the_repository`Patrick Steinhardt, Jul 17, 2025
  44. 01/16 object-file: fix -Wsign-compare warningsPatrick Steinhardt, Jul 17, 2025
  45. Jeff KingApr 5, 2026
  46. 02/16 object-file: stop using `the_hash_algo`Patrick Steinhardt, Jul 17, 2025
  47. 03/16 object-file: get rid of `the_repository` in `has_loose_object()`Patrick Steinhardt, Jul 17, 2025
  48. 04/16 object-file: inline `check_and_freshen()` functionsPatrick Steinhardt, Jul 17, 2025
  49. 05/16 object-file: get rid of `the_repository` when freshening objectsPatrick Steinhardt, Jul 17, 2025
  50. 06/16 object-file: get rid of `the_repository` in `loose_object_info()`Patrick Steinhardt, Jul 17, 2025
  51. 07/16 object-file: get rid of `the_repository` in `finalize_object_file()`Patrick Steinhardt, Jul 17, 2025
  52. 08/16 loose: write loose objects map via their sourcePatrick Steinhardt, Jul 17, 2025
  53. 09/16 odb: introduce `odb_write_object()`Patrick Steinhardt, Jul 17, 2025
  54. 10/16 object-file: get rid of `the_repository` when writing objectsPatrick Steinhardt, Jul 17, 2025
  55. 11/16 object-file: inline `for_each_loose_file_in_objdir_buf()`Patrick Steinhardt, Jul 17, 2025
  56. 12/16 object-file: remove declaration for `for_each_file_in_obj_subdir()`Patrick Steinhardt, Jul 17, 2025
  57. 13/16 object-file: get rid of `the_repository` in loose object iteratorsPatrick Steinhardt, Jul 17, 2025
  58. 14/16 object-file: get rid of `the_repository` in `read_loose_object()`Patrick Steinhardt, Jul 17, 2025
  59. 15/16 object-file: get rid of `the_repository` in `force_object_loose()`Patrick Steinhardt, Jul 17, 2025
  60. 16/16 object-file: get rid of `the_repository` in index-related functionsPatrick Steinhardt, Jul 17, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.