From: Ayush Jha Date: Sun, 08 Feb 2026 07:59:05 GMT Subject: [RFC GSoC PATCH v3 2/2] attr: use local repository state in read_attr Message-ID: <20260208075905.1807-2-kumarayushjha123@gmail.com> In-Reply-To: <20260208075905.1807-1-kumarayushjha123@gmail.com> The read_attr function currently relies on is_bare_repository() to decide whether to check the index or working tree for attributes. This function implicitly depends on the_repository, which is incorrect for library code handling secondary repositories. Update read_attr to use the new repo_settings_get_is_bare(istate->repo) helper. This ensures the logic respects the context of the specific repository associated with the index, while also benefiting from the lazy-loading optimization added in the previous commit. Signed-off-by: Ayush Jha --- attr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/attr.c b/attr.c index 4999b7e09d..2e1cde4615 100644 --- a/attr.c +++ b/attr.c @@ -23,6 +23,7 @@ #include "refs.h" #include "revision.h" #include "odb.h" +#include "repo-settings.h" #include "setup.h" #include "thread-utils.h" #include "tree-walk.h" @@ -848,7 +849,7 @@ static struct attr_stack *read_attr(struct index_state *istate, res = read_attr_from_index(istate, path, flags); } else if (tree_oid) { res = read_attr_from_blob(istate, tree_oid, path, flags); - } else if (!is_bare_repository()) { + } else if (!repo_settings_get_is_bare(istate->repo)) { if (direction == GIT_ATTR_CHECKOUT) { res = read_attr_from_index(istate, path, flags); if (!res) -- 2.53.0.windows.1