Re: [PATCH v2 1/4] worktree: add post-worktree-add hook
Caleb White <[email protected]> Tue, 04 Aug 2026 20:03:57 +0000
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
On Tue Aug 4, 2026 at 1:14 PM CDT, Domen Kožar wrote: > Introduce a post-worktree-add hook that runs after the working tree > has been fully set up, including with --no-checkout and --orphan. The > hook runs inside the new working tree with GIT_DIR and GIT_WORK_TREE > cleared, mirroring the existing post-checkout invocation, and takes no > arguments. Details such as the absolute path, worktree identifier, and > checked-out branch can be queried by running git from the hook's working > directory. Taking no arguments also lets a configured command shared > with post-worktree-remove distinguish the events by argument count. It looks like the `post-worktree-remove` and `post-worktree-move` hooks both receive arguments but this hook does not. While the hook can certainly use git to query the path and identifier, if you already have that information I'm not sure why you can't and shouldn't just pass it through to the hook (same thing goes for the new path and identifier on the move hook). Best, Caleb