From: Tian Yuchen Date: Wed, 17 Jun 2026 15:49:28 GMT Subject: [PATCH 1/2] environment: move ignore_case into repo_config_values Message-ID: <20260617154929.564498-2-cat@malon.dev> In-Reply-To: <20260617154929.564498-1-cat@malon.dev> The 'core.ignorecase' configuration which is stored as the global variable 'ignore_case' acts as a core filesystem capability flag. Move this global variable into 'struct repo_config_values' to tie it to the specific repository instance it was read from. This reduces global state and aligns with the ongoing libification effort. Note that the newly introduced getter, 'repo_get_ignore_case()', intentionally avoids checking 'repo->gitdir'. This could safely accommodates early dynamic probing of the filesystem during 'git init' or clone operations, where the 'gitdir' might not be fully initialized but the filesystem capability must be recorded. Mentored-by: Christian Couder Mentored-by: Ayush Chandekar Mentored-by: Olamide Caleb Bello Signed-off-by: Tian Yuchen --- environment.c | 8 ++++++++ environment.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/environment.c b/environment.c index fc3ed8bb1c..c568d3b6fb 100644 --- a/environment.c +++ b/environment.c @@ -142,6 +142,13 @@ int is_bare_repository(void) return is_bare_repository_cfg && !repo_get_work_tree(the_repository); } +int repo_get_ignore_case(struct repository *repo) +{ + if (repo) + return repo_config_values(repo)->ignore_case; + return 0; +} + int have_git_dir(void) { return startup_info->have_repository @@ -720,5 +727,6 @@ void repo_config_values_init(struct repo_config_values *cfg) { cfg->attributes_file = NULL; cfg->apply_sparse_checkout = 0; + cfg->ignore_case = 0; cfg->branch_track = BRANCH_TRACK_REMOTE; } diff --git a/environment.h b/environment.h index 9eb97b3869..9e3d94fb80 100644 --- a/environment.h +++ b/environment.h @@ -91,6 +91,7 @@ struct repo_config_values { /* section "core" config values */ char *attributes_file; int apply_sparse_checkout; + int ignore_case; /* section "branch" config values */ enum branch_track branch_track; @@ -123,6 +124,13 @@ int git_default_config(const char *, const char *, int git_default_core_config(const char *var, const char *value, const struct config_context *ctx, void *cb); +/* + * Getter for the `ignore_case` field of `struct repo_config_values`. + * It intentionally avoids checking `repo->gitdir` to allow early dynamic + * probing during `git init` or clone. + */ +int repo_get_ignore_case(struct repository *repo); + void repo_config_values_init(struct repo_config_values *cfg); /* -- 2.43.0