From: Jeff King Date: Thu, 11 Jun 2026 08:39:43 GMT Subject: Re: [PATCH 0/3] config: allow disabling config includes Message-ID: <20260611083943.GJ2191159@coredump.intra.peff.net> In-Reply-To: <4d7834c0-d8ab-4dcd-8a7f-ed62c30cbe43@gmail.com> On Tue, Jun 09, 2026 at 08:59:22AM -0400, Derrick Stolee wrote: > > So I dunno. From the described motivation, this feels like a band-aid > > that fixes only one narrow instance of a greater problem. > > > > The notion of enabling/disabling includes per-command is itself a > > flexible building block. So it's possible that it has other uses in > > general. But it's also a fairly broad hammer that covers more than your > > use case. If you're planning to use "git --no-includes" in some script, > > then it breaks the config of anybody who uses includes in their > > user-level ~/.gitconfig file. > > > > So you may need some more directed limiting. > > Are you suggesting some kind of internal sandbox to limit Git from > accessing repository paths from config includes and other config-set keys? > That would be a more complete solution, but I'm not sure how we could plug > all of those holes at once. I'll think on it, though. I don't know that I'm really suggesting anything, but more just thinking out loud. My concern would be that we plug one such hole, and then later find we need more. And then we are stuck with the solution for plugging that hole, even if it may later become redundant. I'm not sure I entirely understand the problematic case, though. The user points to in-repo config (which we already tell people is a bad idea), and then that config breaks for some reason? Because the include is relative and git is run from another directory? If you are going to make such an include, I'd hope you'd at least do it from .git/config, which should reliably resolve relative paths based on the source include file, not the current working directory. > This is exactly the kind of case I was worried about. This specific case > only impacts write operations, but some tools do those things. And this > email case is a common one that users do in their global config to isolate > personal and professional identities. Yeah, I picked it because I suspect it is a very common use of includes. But really it is up to users to do whatever they want with includes, and they'd probably expect them to always work. > I'm trying to think if there's a place where we'd have some config that is > critical to the repo functioning not in its local config (like the repo > format version or extensions). Perhaps borrowing from your work/personal > example, a user could use a different credential helper for work than they > use for personal repositories. It depends what you mean by critical, I suppose. If I happen to prefer shoving all of my diff.*.textconv commands into ~/.gitconfig-diff, then including it with include.path=.gitconfig-diff in ~/.gitconfig, I'd expect it to just work everywhere. But disabling includes would violate that assumption. Probably not _critical_, but it could be annoying and surprising. > Or: are we venturing into territory where we don't even want to create a > new foot-gun? If there were another way to solve the situation that I'm > facing without these risks, then I'd be open to it. Any ideas? Yeah, the more I think on it, the more it seems like a foot-gun. Like I said, I'm not sure I entirely understand the use-case. If you could flesh out an example, that might help. -Peff