Skip to main content

Module worktree_init

Module worktree_init 

Source
Expand description

Change worktree initialization: file copy-over and include-pattern resolution. Change worktree initialization: file copy-over, setup command execution, and include-pattern resolution.

Resolves include patterns from two sources:

  1. worktrees.init.include in the Ito config — a list of glob patterns.
  2. .worktree-include file at the repo root — one glob per line, #-prefixed comment lines and blank lines are ignored.

The union of both sources is used. Patterns are expanded against the source worktree root and matched files are copied into the destination worktree.

After file copy, an optional setup command (or list of commands) from worktrees.init.setup is executed inside the new worktree.

Functions§

copy_include_files
Copy matched include files from source_root into dest_root, preserving relative paths.
init_worktree
Initialize a new change worktree: copy include files, then run setup commands.
parse_worktree_include_file
Parse a .worktree-include file into a list of non-empty, non-comment lines.
resolve_include_files
Resolve all include patterns from config and the .worktree-include file, then expand them against source_root and return the set of matching relative paths (deduplicated, sorted).
run_worktree_setup
Run the configured setup command(s) inside worktree_root.