Skip to content

environment: move ignore_case into repo_config_values#3

Open
malon7782 wants to merge 2 commits into
masterfrom
ignore-case-0
Open

environment: move ignore_case into repo_config_values#3
malon7782 wants to merge 2 commits into
masterfrom
ignore-case-0

Conversation

@malon7782

@malon7782 malon7782 commented Jun 15, 2026

Copy link
Copy Markdown
Owner

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 for repo_get_ignore_case() correct? I recall that when initialising ignore_case during git init, a string is created and read to determine the value. Therefore, I am unsure whether gitdir should 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:

  • [1] In this patch to migrate protect_hfs and protect_ntfs, the approach of introducing getters has been endorsed.
  • [2] Derrick Stolee's previous attempt. The reasons for the failure are also mentioned in [1].

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/

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>
Comment thread environment.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants