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

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

From
Bello Olamide <belkid98@gmail.com>
Date
Jan 5, 2026, 11:39 UTC
Message-ID
<CAD=f0L-ge9FfNh04Nu05eg9Q6t_gtLaPi2=jiT1LXOjF20OO2Q@mail.gmail.com>
In-Reply-To
<CAOLa=ZTOKvEQaMxymi+mRcqyNy4bZ4JbK2HPtq6CeewjHMo_=g@mail.gmail.com>
On Mon, 5 Jan 2026 at 12:09, Karthik Nayak <karthik.188@gmail.com> wrote:
Show 23 quoted lines
>
> Olamide Caleb Bello <belkid98@gmail.com> writes:
> [snip]
>
> > @@ -927,8 +921,13 @@ static void bootstrap_attr_stack(struct index_state *istate,
> >       }
> >
> >       /* home directory */
> > -     if (git_attr_global_file()) {
> > -             e = read_attr_from_file(git_attr_global_file(), flags);
> > +     if (istate && istate->repo)
> > +             repo = istate->repo;
> > +     else
> > +             repo = the_repository;
> > +     attributes_file_path = repo_settings_get_attributesfile_path(repo);
> > +     if (attributes_file_path) {
> > +             e = read_attr_from_file(attributes_file_path, flags);
> >               push_stack(stack, e, NULL, 0);
> >       }
> >
>
> For my own understanding, when can `istate` be NULL?
>

Thank you for your question Karthik. So it was stated in a comment in `apply.c:read_old_data():2340` that `git apply without --index/cached should never look at the index because the target file may not be in the index yet and we may not be in a Git repository.` So NULL is passed to convert_to_git() in place of `istate`.

So when we do `git apply patch.file` `istate` is NULL, but when we do `git apply --cached patch.file`, `istate` is not NULL.

Bello
Previous: Karthik NayakNext: Phillip Wood
Message 9 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.