git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Outreachy PATCH] environment: move "core.attributesFile" into repo-setting

From
Bello Olamide <belkid98@gmail.com>
Date
Jan 2, 2026, 11:26 UTC
Message-ID
<CAD=f0L8K+Ou6Kg5gUEqQpNzbSi-FHMsovOKtJN2hzjFYHywiPQ@mail.gmail.com>
In-Reply-To
<CAOLa=ZRDFdZJWsq5JOckRgfF2V0Whv-jCxbpgeRi80NOs0oTDQ@mail.gmail.com>
On Fri, 2 Jan 2026 at 09:48, Karthik Nayak <karthik.188@gmail.com> wrote:
Show 74 quoted lines
>
> Olamide Caleb Bello <belkid98@gmail.com> writes:
>
> > 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>
> > ---
> > The link to the GitHub CI is provided below
> > https://github.com/cloobTech/git/actions/runs/20284228144
> >
> >  attr.c          | 20 +++++++++-----------
> >  attr.h          |  3 ---
> >  builtin/var.c   |  2 +-
> >  environment.c   |  6 ------
> >  environment.h   |  1 -
> >  repo-settings.c | 10 ++++++++++
> >  repo-settings.h |  8 ++++++++
> >  7 files changed, 28 insertions(+), 22 deletions(-)
>
> The change is very welcome. Apart from some small comments below, the
> patch looks good.
>
> [snip]
>
> > diff --git a/repo-settings.h b/repo-settings.h
> > index d477885561..362f355267 100644
> > --- a/repo-settings.h
> > +++ b/repo-settings.h
> > @@ -68,6 +68,7 @@ struct repo_settings {
> >       unsigned long big_file_threshold;
> >
> >       char *hooks_path;
> > +     char *git_attributes_file;
> >  };
> >  #define REPO_SETTINGS_INIT { \
> >       .shared_repository = -1, \
>
> It would make more sense to rename this variable to
> `attributes_file_path`, that would better denote what is actually stored
> here and syncs better with `repo_settings_get_attributesfile_path`.
>
> > @@ -99,4 +100,11 @@ int repo_settings_get_shared_repository(struct repository *repo);
> >  void repo_settings_set_shared_repository(struct repository *repo, int value);
> >  void repo_settings_reset_shared_repository(struct repository *repo);
> >
> > +/*
> > + * Read the value for "core.attributesfile".
> > + * Defaults to xdg_config_home("attributes") if the core.attributesfile
> > + * isn't available.
>
> While it is obvious, it would be nice to point out that
> `core.attributesfile` is set via config.
>

Thank you for the review Karthik. I will send an updated version with the changes.

Bello.
Previous: Karthik NayakNext: Olamide Caleb Bello
Message 6 of 21 in “environment: move "core.attributesFile" into repo-setting”
  1. environment: move "core.attributesFile" into repo-settingOlamide Caleb Bello, Dec 18, 2025
  2. Bello OlamideDec 18, 2025
  3. Bello OlamideJan 2, 2026
  4. Karthik NayakJan 2, 2026
  5. Karthik NayakJan 2, 2026
  6. Bello OlamideJan 2, 2026
  7. environment: move "core.attributesFile" into repo-settingOlamide Caleb Bello, Jan 2, 2026
  8. Karthik NayakJan 5, 2026
  9. Bello OlamideJan 5, 2026
  10. Phillip WoodJan 5, 2026
  11. Phillip WoodJan 5, 2026
  12. Junio C HamanoJan 5, 2026
  13. Bello OlamideJan 6, 2026
  14. Bello OlamideJan 6, 2026
  15. Phillip WoodJan 7, 2026
  16. Phillip WoodJan 7, 2026
  17. Bello OlamideJan 7, 2026
  18. Bello OlamideJan 6, 2026
  19. Junio C HamanoJan 5, 2026
  20. Phillip WoodJan 7, 2026
  21. Bello OlamideJan 6, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.