Re: [PATCH v2] config: support remote name in includeIf.hasconfig condition
From: Ken Matsui <hidden>
Date: 2024-10-20 17:30:43
On Sunday, October 20th, 2024 at 1:18 PM, Ken Matsui [off-list ref] wrote:
On Sunday, October 20th, 2024 at 12:21 PM, Ramsay Jones ramsay@ramsayjones.plus.com wrote:quoted
On 20/10/2024 17:01, Ken Matsui wrote:quoted
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. :)Actually, this should be as-is. The configuration means only if the GitHub URL is used for origin, we include github.inc. In this repo, we won't include github.inc and only include git.inc for whatever reason. Thank you!
I will soon update this patch's description and add more tests to avoid this kind of confusion.
quoted
quoted
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