`Worktree.Add` walks the entire worktree even when adding a single subdirectory
Adding a nested path costs a full worktree-vs-index diff. doAdd calls w.Status() for any directory path (and for files too, unless SkipStatus is set). Status goes through diffStagingWithWorktree, which builds the "to" side with filesystem.NewRootNodeWithOptions(w.filesystem, …), that constructor takes no path or prefix, so the merkletrie diff always starts at the worktree root. doAddDirectory then iterates the whole status map and throws away everything that doesn't match via isPathInDirectory.
So wt.Add("deeply/nested/dir") scans the entire tree to keep a handful of entries. On a large repo this dominates the cost of Add, and it gets worse the bigger the repo and the more specific the path.
Upstream git just tightened the equivalent path in the other direction: https://github.com/git/git/commit/b6f17686b20647fc904e6201fa6d168731e588eb restores the common-prefix optimization when a leading :(exclude) item had been suppressing it, so git descends only the subtree the positive pathspecs share. We're missing the baseline optimization entirely, not just that edge case.
Source: go-git/go-git