From: Ramsay Jones Date: Sun, 20 Oct 2024 16:21:46 GMT Subject: Re: [PATCH v2] config: support remote name in includeIf.hasconfig condition Message-ID: <086ff955-bcdf-4aba-b6d4-c87f6fc6a724@ramsayjones.plus.com> In-Reply-To: <20241020160143.92382-2-ken@kmatsui.me> On 20/10/2024 17:01, Ken Matsui wrote: > Changes in v2: > > * Updated the description based on Kristoffer's review. > > -- >8 -- > > includeIf.hasconfig only accepts remote.*.url, making it difficult to > apply configuration based on a specific remote, especially in projects > with multiple remotes (e.g., GitHub and non-GitHub hosting). This often > leads to undesired application of multiple config files. > > For example, the following configuration: > > [remote "origin"] > url = https://git.kernel.org/pub/scm/git/git.git > [remote "github"] > url = https://github.com/myfork/git.git > > [includeIf "hasconfig:remote.*.url:https://github.com/**"] > path = github.inc > [includeIf "hasconfig:remote.*.url:https://git.kernel.org/**"] > path = git.inc > > would apply both github.inc and git.inc, even when only one config is > intended for the repository. > > Introduce support for specifying a remote name (e.g., origin) to enable > more precise configuration management: > > [includeIf "hasconfig:remote.origin.url:https://github.com/**"] s/remote.origin.url/remote.github.url/ ? I haven't actually read the patch, so take with a pinch of salt. :) > path = github.inc > [includeIf "hasconfig:remote.origin.url:https://git.kernel.org/**"] > path = git.inc > > This ensures that only the intended config file is applied based on the > specific remote. > ATB, Ramsay Jones