Subject: [Outreachy PATCH v5 0/3] store repo specific config values in new `struct repo_config_values`

From: Olamide Caleb Bello <[email-masked]>
Date: Sat, 24 Jan 2026 13:21:10 +0100

Hi Git Community,
Over the course of my ongoing internship, which focused on moving repo specific
global variables in environment.h into local scope, I have attempted to move some
variables into the struct repo-settings.
However there has been some design concerns as regards the use of
`prepare_repo_settings()` with respect to when and where to call the
function, and also the change in behaviours when the variable is lazily
loaded as discussed in [1] and [2].

After different deliberations, Phillip Wood proposed creating a new config
struct [3], adding it to the repository struct and passing the repo struct to
`git_default_config()` to store parsed repo specific config values per repo.
This ensures the current behaviours will be retained.

I have experimented with this approach for some values and I would
appreciate feedbacks about this approach before we can move forward
and use it for more variables related to `git_default_config()`.

For now, the parsed value is stored in `the_repository` in
`git_default_*_config()` and further efforts to pass the repository
parameter to `git_default_config()` as the callback parameter will
be looked into later on.
The link to the CI tests can be see in [4]

1. https://lore.kernel.org/git/[email-masked]/
2. https://lore.kernel.org/git/[email-masked]/
3. https://lore.kernel.org/git/[email-masked]/
4. https://gitlab.com/gitlab-community/gitlab-org/git/-/pipelines/2266020513

Changes in v5:
==============
- Corrected mistake in commit message of patch 3 which spelt branch
  wrongly in `branch.autoSetupmerge`

Olamide Caleb Bello (3):
  environment: stop storing `core.attributesFile` globally
  environment: stop using core.sparseCheckout globally
  environment: move "branch.autoSetupMerge" into `struct
    repo_config_values`

 attr.c                      |  7 ++++---
 branch.h                    |  2 --
 builtin/backfill.c          |  2 +-
 builtin/branch.c            |  2 +-
 builtin/checkout.c          |  2 +-
 builtin/clone.c             |  2 +-
 builtin/grep.c              |  2 +-
 builtin/mv.c                |  2 +-
 builtin/push.c              |  2 +-
 builtin/sparse-checkout.c   | 23 ++++++++++++-----------
 builtin/submodule--helper.c |  2 +-
 builtin/worktree.c          |  2 +-
 dir.c                       |  2 +-
 environment.c               | 28 ++++++++++++++++++----------
 environment.h               | 14 ++++++++++++--
 repository.c                |  1 +
 repository.h                |  4 ++++
 sparse-index.c              |  6 ++++--
 unpack-trees.c              |  2 +-
 wt-status.c                 |  3 ++-
 20 files changed, 68 insertions(+), 42 deletions(-)

Range diff versus v4:
====================
1:  d28850bcdb = 1:  d28850bcdb environment: stop storing `core.attributesFile` globally
2:  5e56e1cc41 = 2:  5e56e1cc41 environment: stop using core.sparseCheckout globally
3:  aed3183321 ! 3:  e7f37bac87 environment: move "branch.autoSetupMerge" into `struct repo_config_values`
    @@ Metadata
      ## Commit message ##
         environment: move "branch.autoSetupMerge" into `struct repo_config_values`

    -    The config value `brach.autoSetupMerge` is parsed in
    +    The config value `branch.autoSetupMerge` is parsed in
         `git_default_branch_config()` and stored in the global variable
         `git_branch_track`. This global variable can be overwritten
         by another repository when multiple Git repos run in the the same process.

-- 
2.34.1