Skip to content

Commit 38afe55

Browse files
committed
attr: use repo_settings_get_attributesfile_path() and update callers
The functions `bootstrap_attr_stack()` and `git_attr_val_system()` retrieve the "core.attributes" file via `git_attr_global_file()` which reads from global state `git_attributes_file`. Update the related functions to retrieve "core.attributesfile" via the new accessor function `repo_settings_get_attributesfile_path()` This improves multi-repository behaviour and aligns with the goal of libifying of Git. Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
1 parent f482fe1 commit 38afe55

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@ static void bootstrap_attr_stack(struct index_state *istate,
919919
}
920920

921921
/* home directory */
922-
if (git_attr_global_file()) {
923-
e = read_attr_from_file(git_attr_global_file(), flags);
922+
if (repo_settings_get_attributesfile_path(istate->repo)) {
923+
e = read_attr_from_file(repo_settings_get_attributesfile_path(istate->repo), flags);
924924
push_stack(stack, e, NULL, 0);
925925
}
926926

builtin/var.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static char *git_attr_val_system(int ident_flag UNUSED)
7272

7373
static char *git_attr_val_global(int ident_flag UNUSED)
7474
{
75-
char *file = xstrdup_or_null(git_attr_global_file());
75+
char *file = xstrdup_or_null(repo_settings_get_attributesfile_path(the_repository));
7676
if (file) {
7777
normalize_path_copy(file, file);
7878
return file;

0 commit comments

Comments
 (0)