Subject: Re: [GSOC PATCH v6 0/3] environment: remove sparse-checkout related global variables

From: Junio C Hamano <[email-masked]>
Date: Thu, 24 Jul 2025 11:44:13 -0700

Derrick Stolee <[email-masked]> writes:

> There are two ways to change the approach here to fix the problem
> of needing prepare_repo_settings() everyhwere:
>
>  1. With the idea that these sparse-checkout variables are
>     critical to the functionality of the repo, they should move
>     into the repository struct itself and be initialized along
>     with all other values there. This changes the patches (and my
>     follow-up series) significantly, but mechanically.
>
>  2. If we are going to change the intention of the repo settings
>     struct to move from "optional one-off feature flags" to
>     "important information about the core behavior of a repo"
>     then we should prepare_repo_settings() when initializing the
>     repository struct.
>
> My preference is (1). The only argument for (2) that I can think
> of is that it is sometimes helpful to share only the settings for
> a repo without sharing the whole repo. But that seems like a weak
> reason right now.

I do agree with the sentiment that being able to pass &repo.settings
to helper function makes us feel safer, but I agree that it is a
weak argument.  If we reexamine other things in repo_settings, it
may turn out that the same reasoning applies to them and we may be
better off to roll repo_settings into the repository itself (after
all, it is an embedded structure, not even a pointer in the main
structure that points at an indenendent repo_settings structure),
but that is totally outside the scope of this discussion.

Thanks.