environment: move ignore_case into repo_config_values#3
Open
malon7782 wants to merge 2 commits into
Open
Conversation
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 <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>
Replace the accesses to the global 'ignore_case' variable with calls to 'repo_get_ignore_case(the_repository)'. This step eliminates the 'ignore_case' global state. Note on compat/win32/path-utils.c: To eliminate the global state, several helper functions (e.g. 'win32_fspathncmp()') now read from 'repo_get_ignore_case(the_repository)'. While this introduces dependency on 'repository.h' into the 'compat/', it avoids massive refactoring of the signatures across the codebase. 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>
chriscool
reviewed
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 'core.ignorecase configuration', stored as the global variable 'ignore_case', acts as a core filesystem capability flag.
This series continues the ongoing libification effort by moving this global variable into struct 'repo_config_values', tying it to the specific repository instance it was read from. This allows us to encapsulate the configuration without altering its eager-parsing behavior.
The getter function 'repo_get_ignore_case()' is introduced so that we can safely retrieve the configuration value whilst maintaining the correct fallback logic.
RFC Questions:
environment.h--- Is the fallback logic forrepo_get_ignore_case()correct? I recall that when initialisingignore_caseduringgit init, a string is created and read to determine the value. Therefore, I am unsure whethergitdirshould be used here, since it might not be ready when we access it.dir.c--- Performance overhead?compat/win32/path-utils.c--- Is it appropriate to include the repository.h header file?Related materials:
protect_hfsandprotect_ntfs, the approach of introducing getters has been endorsed.Thanks!
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
[1] https://lore.kernel.org/git/20260606143412.15443-1-cat@malon.dev/
[2] https://lore.kernel.org/git/2b4198c09cb6c04c60608d19072d419503dfe5df.1685716421.git.gitgitgadget@gmail.com/