Subject: Re: [PATCH v4 0/2] includeIf: add "worktree" condition for matching working tree path

From: Junio C Hamano <[email-masked]>
Date: Mon, 25 May 2026 12:01:36 +0900

Chen Linxuan <[email-masked]> writes:

> On Mon, May 25, 2026 at 10:14 AM Junio C Hamano <[email-masked]> wrote:
>>
>> Chen Linxuan via B4 Relay <[email-masked]>
>> writes:
>>
>> > The `includeIf` mechanism already supports matching on the `.git`
>> > directory path (`gitdir`) and the currently checked out branch
>> > (`onbranch`).  But in multi-worktree setups the `.git` directory of a
>> > linked worktree points into the main repository's `.git/worktrees/`
>> > area, which makes `gitdir` patterns cumbersome when one wants to
>> > include config based on the working tree's checkout path instead.
>> >
>> > Introduce two new condition keywords:
>> >
>> >   - `worktree:<pattern>` matches the realpath of the current worktree's
>> >     working directory against a glob pattern.
>> >   - `worktree/i:<pattern>` is the case-insensitive variant.
>> >
>> > Supported pattern features: glob wildcards, `**/` and `/**`, `~`
>> > expansion, `./` relative paths, and trailing-`/` prefix matching.
>> > The condition never matches in a bare repository.
>> >
>> > Signed-off-by: Chen Linxuan <[email-masked]>
>> > ---
>>
>> The test in this series fails in GitHub CI for Windows, it seems.
>>
>> https://github.com/git/git/actions/runs/26377220573/job/77639885088
>
> It seems that "includeIf.worktree:/.path" not working on windows.
>
> Will be updated in V5

The topic has long been merged to 'next', but I've reverted the
topic out of 'next', so I can take a new iteration.

Thanks.