List ignored directories as single entries and only search inside them
when a .worktreeinclude pattern matches the directory or names a path
inside it. A bare .env no longer selects node_modules/pkg/.env.
Verified with real Git and isolated daemon workspace creation on Linux.
With 300,000 ignored files, Git trace2 recorded over 6,000 directory
visits before the fix and fewer than five after. The workspace copied
the root .env. The lifecycle test also verified rollback when copying
fails.
Closes#10004
Co-authored-by: mgranderath <22001111+mgranderath@users.noreply.github.com>
(cherry picked from commit 871c714b46)
* feat(worktrees): copy included local files before setup and agents
Keep local-file materialization in one built-in lifecycle hook so workspace setup and the first agent see the completed copy. Reuse the community plugin algorithm with the source checkout supplied by the worktree hook.
Co-authored-by: Carlos Precioso <github@precioso.design>
* test(plugins): make worktree lifecycle checks portable on Windows
Compare source checkout filesystem identity across Git and Windows path spellings. Exercise copy rollback with a destination file blocking a directory, since Git for Windows accepts directories as exclude files.
---------
Co-authored-by: Carlos Precioso <github@precioso.design>