feat(server): copy .worktreeinclude files into new worktrees - #7956
feat(server): copy .worktreeinclude files into new worktrees#7956Sriram-52 wants to merge 7 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…on-tolerant Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ApprovabilityVerdict: Skipped Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 71252d5. Configure here.
…tories Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

New worktrees start with tracked files only, so untracked local files like
.envnever make it across; today every repo has to hand-roll that copy in its setup script. This adds support for a repo-root.worktreeincludefile (same convention as Claude Code): gitignore-style patterns of untracked files to copy into each newly created worktree.The copy runs in the VCS driver's
createWorktree, right aftergit worktree add, so all three creation paths get it (thread bootstrap, PR threads, and the mobilevcs.createWorktreeRPC) and it completes before the project setup script launches. Git does the pattern matching itself viagit ls-files --others --ignored --exclude-from, so semantics are exactly gitignore's with no matcher code of our own. Copying is best-effort: a failed copy logs a warning and never blocks worktree creation.Includes driver tests against real git (pattern matching incl. nested files and directory patterns, plus the failure path) and a user doc at
docs/user/worktrees.md.Built with Claude Fable 5 on Claude Code.
🤖 Generated with Claude Code
Note
Medium Risk
Adds filesystem copies of typically-secret untracked files into new worktrees, with symlink-escape checks and best-effort error swallowing. A bug in containment or matching could leak files outside the worktree or skip intended copies.
Overview
New worktrees now copy untracked files matching a repo-root
.worktreeinclude(gitignore-style patterns, typically.envand similar) from the source checkout into the new tree, right aftergit worktree addand before setup scripts.Git does the matching via
ls-files --others --ignored --exclude-from. Copies are best-effort: failures and oversized listings log warnings and never roll back worktree creation. Checked-out tracked files win on collisions; writes through tracked symlinks are skipped. Relative worktree paths are resolved againstcwdso the copy target matches git.User docs live in
docs/user/worktrees.md.Reviewed by Cursor Bugbot for commit ed8a86b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Copy
.worktreeinclude-matched untracked files into new worktreescopyWorktreeIncludedFilestoGitVcsDriverCore, which lists untracked files matching a repo-root.worktreeincludeviagit ls-files --others --ignored --exclude-from(60s timeout) and best-effort copies them into the newly created worktree.createWorktreenow resolves relative worktree paths againstcwdsoworktree.pathis absolute and matches git behavior; copy failures are logged without failing worktree creation.ls-filesoutput results in a partial copy with a warning, so users should verify.worktreeincluderesults in GitVcsDriverCore.ts.Macroscope summarized ed8a86b.