Skip to content

we should copy over build artifacts on spawning a worktree so incremental builds can be cached #449

@kwannoel

Description

@kwannoel

Summary

When spawning a new git worktree, builds start from scratch because no build artifacts are carried over. Copying existing build artifacts (e.g., target/, node_modules/.cache, .svelte-kit) into the new worktree would enable incremental builds and significantly reduce initial compile times.

Details

Currently, git worktree add creates a clean working directory with no build artifacts. For Rust/Tauri projects, this means a full cargo build from zero on every new worktree — often taking several minutes.

If we copy (or hard-link) the target/ directory and other cacheable artifacts from the source worktree into the new one, subsequent builds can leverage incremental compilation and only rebuild what changed.

Proposed approach:

  • After git worktree add, copy key build artifact directories from the parent worktree
  • Use hard links or cp -al where possible to save disk space and time
  • Directories to consider: src-tauri/target/, node_modules/, .svelte-kit/

Considerations:

  • Hard links vs full copies (trade-off: speed/space vs isolation)
  • Some artifacts may contain absolute paths that need invalidation
  • Should be opt-in or configurable in case it causes issues

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions