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

Re: [PATCH v2] config: support remote name in includeIf.hasconfig condition

From
KMKen Matsui <ken@kmatsui.me>
Date
Oct 20, 2024, 17:30 UTC
Message-ID
<3QE-ZkcELIkznxtQD_EXgNaoyGwIe26lO2RJ8S2qnqcD1T1tcKWuvxgVaV_WxLooZMVld4wEJdkhbQD1HK494wbc52rrqzkbvPKHaosr8v0=@kmatsui.me>
In-Reply-To
<EEsVJheBDeI0kEJr8KABt7dw0F14feUrMlvzJsmzrGmUBwt19aSJd4iWClSlzQ1GSoIe6qMQ5OcoiWYF9LQDPu-26QWmDy57efnYaZX6ZSo=@kmatsui.me>
On Sunday, October 20th, 2024 at 1:18 PM, Ken Matsui <ken@kmatsui.me> wrote:
Show 48 quoted lines
> 
> 
> On Sunday, October 20th, 2024 at 12:21 PM, Ramsay Jones ramsay@ramsayjones.plus.com wrote:
> 
> > 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. :)
> 
> 
> 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.
Show 10 quoted lines
> 
> > > 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
Previous: Ken MatsuiNext: Ken Matsui
Message 7 of 10 in “config: support remote name in includeIf.hasconfig condition”
  1. config: support remote name in includeIf.hasconfig conditionKen Matsui, Oct 20, 2024
  2. Kristoffer HaugsbakkOct 20, 2024
  3. Ken MatsuiOct 20, 2024
  4. config: support remote name in includeIf.hasconfig conditionKen Matsui, Oct 20, 2024
  5. Ramsay JonesOct 20, 2024
  6. Ken MatsuiOct 20, 2024
  7. Ken MatsuiOct 20, 2024
  8. config: support remote name in includeIf.hasconfig conditionKen Matsui, Oct 20, 2024
  9. Ken MatsuiNov 6, 2024
  10. Junio C HamanoDec 3, 2024

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.