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

Re: [PATCH 2/3] config: add GIT_CONFIG_INCLUDES

From
Derrick Stolee <stolee@gmail.com>
Date
Jun 8, 2026, 19:38 UTC
Message-ID
<dd971b9e-2c13-4521-b991-b9bee1c5bf5b@gmail.com>
In-Reply-To
<aibTAOrcSvTOtv78@pks.im>
On 6/8/2026 10:34 AM, Patrick Steinhardt wrote:
Show 30 quoted lines
> On Mon, Jun 08, 2026 at 01:57:05PM +0000, Derrick Stolee via GitGitGadget wrote:
>> From: Derrick Stolee <stolee@gmail.com>
>>
>> The config keys 'include.path' and 'includeIf.*' allow users to specify
>> config stored in a location outside of the typical list of config files
>> (system, global, local, etc.). For example, users who accept the risk
>> can specify helpful aliases via a file checked into the repo by pointing
>> 'include.path' to the position of that file in the working directory.
>> This is dangerous, but people do it.
> 
> Huh, I never even considered this use case. But of course, this is
> possible, even though it's quite scary.
> 
>> What becomes tricky is that this modifies all Git behavior, including
>> operations that are intended to be limited in activity or sandboxed in
>> some way. These include directives can provide surprising changes to
>> behavior, especially when expecting a specific list of allowed file
>> accesses. This could lead to failed builds, for instance.
>>
>> To allow for these user-desired features when they are running commands,
>> add a new GIT_CONFIG_INCLUDES environment variable that disables these
>> redirections of config when set to zero. This variable can be set by
>> automation, such as build tooling, to avoid these strange behaviors.
>> This could be considered a recommended option for tools executing Git
>> commands, the same as GIT_ADVICE=0.
> 
> I don't know about this part though. I could see use cases where the
> tools _should_ read the project-relative configuration. It might also be
> the case that the user may want to evaluate some includes, but not all
> of them.

True. I'm not confident that we should recommend this environment in all cases.

> That raises the question whether we can introduce the configuration in a
> way that it allows a bit more flexibility than just "yes"/"no", like for
> example an allow-list of locations that should be evaluated. But maybe
> I'm overthinking this.

I see. So we can say "avoid including into the repository worktree" but that will probably be incomplete.

There is room for nuance in future expansions, if we can find a creative way to handle that nuance. For now, I think I would still want an ability to turn the entire feature off, at least for certain tools that care.

Thanks, -Stolee

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 5 of 14 in “config: allow disabling config includes”
  1. 0/3 config: allow disabling config includesDerrick Stolee via GitGitGadget, Jun 8, 2026
  2. 1/3 git-config.adoc: fix paragraph breakDerrick Stolee via GitGitGadget, Jun 8, 2026
  3. 2/3 config: add GIT_CONFIG_INCLUDESDerrick Stolee via GitGitGadget, Jun 8, 2026
  4. Patrick SteinhardtJun 8, 2026
  5. Derrick StoleeJun 8, 2026
  6. Patrick SteinhardtJun 9, 2026
  7. 3/3 git: add --no-includes top-level optionDerrick Stolee via GitGitGadget, Jun 8, 2026
  8. Jeff KingJun 8, 2026
  9. Derrick StoleeJun 9, 2026
  10. Jeff KingJun 11, 2026
  11. Derrick StoleeJun 11, 2026
  12. Junio C HamanoJun 17, 2026
  13. Derrick StoleeJun 17, 2026
  14. Junio C HamanoJun 17, 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.