From: Bello Olamide Date: Mon, 05 Jan 2026 11:39:19 GMT Subject: Re: [Outreachy PATCH v2] environment: move "core.attributesFile" into repo-setting Message-ID: In-Reply-To: On Mon, 5 Jan 2026 at 12:09, Karthik Nayak wrote: > > Olamide Caleb Bello 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