Re: [PATCH v3 2/2] config: add "worktree" and "worktree/i" includeIf conditions
- From
Chen Linxuan <me@black-desk.cn>
- Date
- May 13, 2026, 02:55 UTC
- Message-ID
- <CAC1kPDNAFRp+t+_KRUfV_nUXj6nFBNEHp05odiVXsUOw3+tcrA@mail.gmail.com>
- In-Reply-To
- <xmqqo6iklid5.fsf@gitster.g>
On Wed, May 13, 2026 at 12:09 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> > Phillip Wood <phillip.wood123@gmail.com> writes: > > > On 12/05/2026 08:14, Patrick Steinhardt wrote: > > ... > >>> Introduce two new condition keywords: > >>> > >>> - worktree:<pattern> matches the realpath of the current worktree's > >>> working directory (i.e. repo_get_work_tree()) against a glob > >>> pattern. This is the path returned by git rev-parse > >>> --show-toplevel. > >>> > >>> - worktree/i:<pattern> is the case-insensitive variant. > >> > >> Seems sensible. > > > > We already support per-worktree config settings via > > extensions.worktreeConfig, so it would be helpful to explain why it is > > more convenient to set the config based on the worktree's path, rather > > than just running "git config --worktree" inside the worktree. Do you > > have multiple repositories with worktrees checked out under a common > > prefix that you want to share the same config setting?
Yes, that is exactly why I added this feature. I contribute to the Linux kernel both as an employee and as an individual. I want to automatically use my company email address whenever I create a worktree under a specific directory.