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

[PATCH v2 1/2] environment: move ignore_case into repo_config_values

From
Tian Yuchen <cat@malon.dev>
Date
Jun 18, 2026, 11:42 UTC
Message-ID
<20260618114207.605211-2-cat@malon.dev>
In-Reply-To
<20260618114207.605211-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.

To ensure code readability, the getter function 'repo_ignore_case()' is introduced.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Mentored-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Tian Yuchen <cat@malon.dev>
---
 environment.c | 8 ++++++++
 environment.h | 8 ++++++++
 2 files changed, 16 insertions(+)
diff --git a/environment.c b/environment.c
index fc3ed8bb1c..bfa3cb3045 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_ignore_case(struct repository *repo)
+{
+	return (repo && repo->initialized) ?
+		repo_config_values(repo)->ignore_case :
+		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..39a8bf0b49 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 checks `repo->initialized` to prevent calling repo_config_values()`
+ * before the repository setup is fully complete or in non-git environments.
+ */
+int repo_ignore_case(struct repository *repo);
+
 void repo_config_values_init(struct repo_config_values *cfg);
 
 /*
-- 
2.43.0
Previous: Tian YuchenNext: Tian Yuchen
Message 7 of 18 in “environment: move ignore_case into repo_config_values”
  1. 0/2 environment: move ignore_case into repo_config_valuesTian Yuchen, Jun 17, 2026
  2. 1/2 environment: move ignore_case into repo_config_valuesTian Yuchen, Jun 17, 2026
  3. Junio C HamanoJun 17, 2026
  4. Tian YuchenJun 18, 2026
  5. 2/2 config: use repo_get_ignore_case() to access core.ignorecaseTian Yuchen, Jun 17, 2026
  6. 0/2 environment: move ignore_case into repo_config_valuesTian Yuchen, Jun 18, 2026
  7. 1/2 environment: move ignore_case into repo_config_valuesTian Yuchen, Jun 18, 2026
  8. 2/2 config: use repo_ignore_case() to access core.ignorecaseTian Yuchen, Jun 18, 2026
  9. Junio C HamanoJun 18, 2026
  10. Tian YuchenJun 19, 2026
  11. 0/2 environment: move ignore_case into repo_config_valuesTian Yuchen, Jun 19, 2026
  12. 1/2 environment: move ignore_case into repo_config_valuesTian Yuchen, Jun 19, 2026
  13. 2/2 config: use repo_ignore_case() to access core.ignorecaseTian Yuchen, Jun 19, 2026
  14. Junio C HamanoJun 21, 2026
  15. Tian YuchenJun 22, 2026
  16. Junio C HamanoJun 22, 2026
  17. Johannes SchindelinJul 10, 2026
  18. Junio C HamanoJul 10, 2026

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.