Expand description
The plan for one git worktree add that the cheap-worktree ladder serves: its destination and insertion point.
What:
The plan for one git worktree add the cheap-worktree ladder may serve: where the new worktree goes and where in
the argument list a rung inserts --no-checkout, or nothing when the invocation uses a form the ladder does not
know.
Why:
The ladder runs real Git once with the person’s arguments, so it only needs the destination path and a promise that
every other word means what the table says. An option the table does not list, a bundled short flag, a global
option that changes how Git reads configuration, or a destination whose parent does not exist makes the whole
invocation a plain Git run, which is always correct.
In TS you’d write (pseudocode):
const plan = parseAddPlan(['-C', 'repo', 'worktree', 'add', '-b', 'topic', '../topic'], 1, cwd); // undefined: plain GitStructs§
- AddPlan
- What:
The facts of a
git worktree addthe ladder serves.usizeis an unsigned size or index;PathBufis an owned file-system path. Why: The destination decides the subvolume to create and the worktree to settle; the insertion index decides where--no-checkoutgoes in the arguments real Git receives.
Functions§
- copy_
start_ directory - What:
The directory a command’s relative destination is resolved against, after the global options.
Why:
Only
-Cmoves it; the others change nothing about it. An option this reading does not know leaves the destination unknown, and the copy then says it did not run. - parse_
add_ plan - What:
Plan one invocation:
argumentsis the whole argument list,subcommand_indexthe index ofworktreein it, andstartthe directory the command starts in. Why: The word directly afterworktreemust beadditself, because Git reads the subcommand there and never abbreviates it. - parse_
copy_ destination - What:
The destination a
git worktree addnames, in the form Git records it, for every form Git’s option parser accepts. Why: The ignored-state copy goes to the worktree this command created, found from the command line instead of by comparing the repository’s registrations before and after, which another add running at the same time would disturb. - start_
directory - What:
The directory a command starts in: the process directory moved by every
-C <dir>of the global prefix, or nothing when the prefix holds an option the ladder does not serve. Why: Git changes directory at each-Cin turn, and a relative destination is relative to the result. A..component in a-Cvalue is declined, because following it lexically differs from Git’s directory changes through a symbolic link.