Skip to content

Windows: new worktrees fail with 'Filename too long' on TUnit.Templates.Tests snapshots #7320

Closed

Description

@thomhurst

What I saw

On Windows, git worktree add -b <branch> D:/git/TUnit-worktrees/issue-7190-generator-test-parse-options origin/main failed partway through checkout:

error: unable to create file tests/TUnit.Templates.Tests/Snapshots/InstantiationTest.TUnit.Aspire.Starter._.verified/TUnit.Aspire.Starter/TUnit.Aspire.Starter.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map: Filename too long
fatal: Could not reset index file to revision 'HEAD'.

The worktree was not registered, but the branch was left behind. The template snapshot paths exceed MAX_PATH once they sit under <repo-parent>/TUnit-worktrees/<name>/.

Workaround used

git -c core.longpaths=true worktree add --no-checkout ..., then git config core.longpaths true (this writes the shared repo config), then git checkout.

Expected

The worktree lifecycle docs (scripts/WorktreeLifecycle.md, AGENTS.md § Local worktree lifecycle) or the lock and worktree scripts should handle this on Windows: either document setting core.longpaths=true, or set it when creating worktrees, so agents do not hit this on every new checkout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: edge case, mode divergence, flaky test, or workaround existsbugSomething isn't workingin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions