[PATCH v10 0/9] migrate more variables into repo_config_values
- From
Tian Yuchen <cat@malon.dev>
- Date
- Jul 12, 2026, 11:17 UTC
- Message-ID
- <20260712111734.1073514-1-cat@malon.dev>
- In-Reply-To
- <20260709161145.13349-1-cat@malon.dev>
Hi everyone,
This patch series continues the ongoing libification effort by migrating a batch of global configuration variables into struct repo_config_values.
What does this series do:
infrastructure & strings (commits 1-6): Introduce 'repo_config_values_clear()' to manage the lifecycle of heap-allocated configuration strings. This infrastructure is utilized to migrate string variables, including 'excludes_file', 'apply' whitespace configs, and external programs including 'editor', 'pager', 'askpass'.
enums (commits 7-9): Migrate enumerations 'push_default', 'autorebase', and 'object_creation_mode'. Care was taken to make these types available to the configuration structure without triggering circular header dependencies.
RFC:
Commit 3~5. Is it really necessary to migrate _program variables? https://lore.kernel.org/git/8e657184-ee0b-453a-9f2d-a98080d3582e@gmail.com/
Commit 6~9. Previous related discussions on 'git_branch_track'. https://lore.kernel.org/git/CAD=f0L-mPX+KECUjXk-WBzEbTP7wCa8sB56GySQT0yh9mfUOWw@mail.gmail.com/
Note:
Since a new getter 'repo_excludes_file()' is introduced, as previously promised, once it is finally merged into 'master', there will be a patch to update and squash the comments.
Similarly, I've noticed that the classification and sorting of variables in 'repo_config_values' don't seem to be correct. There will also be a patch to fix this, and I think it will form a commit series along with the comment patch?
Changes since v9:
- Fixed a few typos.
- Drop an unnecessary branching in editor.c
- Use repo_config_values *cfg to avoid multiple calls to repo_config_values() in repo_excludes_file().
- Let repo_config_values_clear() receive 'struct repo_config_values' and do not check (repo != the_repository) anymore. In repo_clear(), pass in config_values_private_ instead so that we don't need to filter calls with uninitialized repos. Therefore, drop the NEEDSWORK comment.
Special thanks to Pablo!
Tian Yuchen (9):
repository: introduce repo_config_values_clear()
environment: move excludes_file into repo_config_values
environment: move editor_program into repo_config_values
environment: move pager_program into repo_config_values
environment: move askpass_program into repo_config_values
environment: migrate apply_default_whitespace and
apply_default_ignorewhitespace
environment: move push_default into repo_config_values
environment: move autorebase into repo_config_values
environment: move object_creation_mode into repo_config_valuesapply.c | 20 ++++++++------ branch.c | 2 +- builtin/push.c | 8 +++--- dir.c | 4 +-- editor.c | 4 +-- environment.c | 75 +++++++++++++++++++++++++++++++++----------------- environment.h | 75 +++++++++++++++++++++++++++++++------------------- object-file.c | 2 +- pager.c | 26 +++++++++++------ prompt.c | 3 +- remote.c | 2 +- repository.c | 1 + 12 files changed, 140 insertions(+), 82 deletions(-)
-- 2.43.0