Expand description
The linked-worktree ignored-state copy around one forwarded Git invocation: the integrator’s entry point. What: The linked-worktree ignored-state copy around one forwarded Git invocation: the public entry point the integrator calls, the settlement and summary it writes, and the exit status it returns. Why: A worktree that Git creates (or a bare repository’s) needs its ignored files from the source worktree. No lock stands around the command: the destination comes from the command line, the copy is a transaction of its own (a journal and a stage claim that name their owner process), and a copy a dead process left is recovered first by the next command. Concurrent adds in one repository never wait for one another (the owner’s decision of 2026-11-03).
Integrator contract:
The caller decides the bypass facts (--no-worktree-copy, short-circuit global help or version, whether the
command creates a worktree after alias resolution, and the destination its command line names) with the native
modules that already own them, passes the repository identity and the effective working directory, and supplies the
runner that starts real Git. This module never runs the commit refusal; it is not wired yet.
A main-checkout source is observed only when the command creates a worktree; it then hands over its ignored
state under the main checkout’s leave-out rule (worktree_copy_prune.rs), with its registered worktrees excluded.
In TS you’d write (pseudocode):
await runGitWithWorktreeCopy({ args, gitPath, identity, command, environment });Structs§
- GitStatus
- What: How a real Git run ended. Why: Its numeric status is the exit status the wrapper keeps; a signal has none.
- Invocation
- What: Everything the lifecycle needs to decide how one invocation is settled. Why: The decisions that depend on argv and global options are made by their owners and passed in as facts.
- Settlement
- What: The result of one settled invocation: Git’s status and the copy failure, if any. Why: Both facts decide the exit status, so they travel together.
Enums§
- GitStep
- What:
Which Git run the settlement asks its runner to start.
Why:
The person’s command is one run; the cheap-worktree ladder adds
--no-checkoutto it and starts the commands that complete the worktree itself, each with the caller’s streams.
Functions§
- exit_
code - What: The exit status of a settled invocation. Why: A copy-only failure is 2; Git’s own status is kept when Git failed; a signal without a status is 1.
- run_
with_ worktree_ copy - What:
Settles one forwarded invocation: bypasses forward untouched; every other command first recovers what dead owners left,
and a creating command then copies the ignored state into the worktree it created.
Why:
The integrator calls this once per forwarded command and turns the settlement into the exit status with
exit_code. - summary_
line - What: The one summary line a successful copy writes. Why: Users and agents read the count, the source, and the destination count from it.
Type Aliases§
- GitRunner
- Runs one real Git step.