Skip to main content

init_worktree

Function init_worktree 

Source
pub fn init_worktree(
    source_root: &Path,
    dest_root: &Path,
    config: &WorktreesConfig,
) -> CoreResult<()>
Expand description

Initialize a new change worktree: copy include files, then run setup commands.

This is the full initialization sequence called after a worktree is created:

  1. Copy include files from source_root into dest_root (idempotent).
  2. Run setup commands from config.init.setup in dest_root (if configured).

Coordination symlink wiring is handled separately by the caller because it requires the .ito/ path context which this function does not own. Today that means ito worktree ensure wires new and partially initialized worktrees, while ito init --update can repair the current worktree.

ยงErrors

Returns CoreError if file copy fails or a setup command exits non-zero.