]> git.ipfire.org Git - thirdparty/git.git/commit
environment: move "core.attributesFile" into repo-setting
authorOlamide Caleb Bello <belkid98@gmail.com>
Fri, 2 Jan 2026 16:32:50 +0000 (16:32 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 4 Jan 2026 06:05:10 +0000 (15:05 +0900)
commit32fadb3779ddfef0ebb96d978174292b83ec8d78
tree4df66c3922078ddf28cb6dda9e71fa69a6b01145
parent68cb7f9e92a5d8e9824f5b52ac3d0a9d8f653dbe
environment: move "core.attributesFile" into repo-setting

When handling multiple repositories within the same process, relying on
global state for accessing the "core.attributesFile" configuration can
lead to incorrect values being used. It also makes it harder to isolate
repositories and hinders the libification of git.
The functions `bootstrap_attr_stack()` and `git_attr_val_system()`
retrieve "core.attributesFile" via `git_attr_global_file()`
which reads from global state `git_attributes_file`.

Move the "core.attributesFile" configuration into the
`struct repo_settings` instead of relying on the global state.
A new function `repo_settings_get_attributesfile_path()` is added
and used to retrieve this setting in a repository-scoped manner.
The functions to retrieve "core.attributesFile" are replaced with
the new accessor function `repo_settings_get_attributesfile_path()`
This improves multi-repository behaviour and aligns with the goal of
libifying of Git.

Note that in `bootstrap_attr_stack()`, the `index_state` is used only
if it exists, else we default to `the_repository`.

Based-on-patch-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c
attr.h
builtin/var.c
environment.c
environment.h
repo-settings.c
repo-settings.h