Expand description
git cli-git convert-worktree-to-subvolume: the worktrees to cover and the report.
What:
git cli-git convert-worktree-to-subvolume: parse the options, find the worktrees to convert, run the conversion on each,
and turn the results into lines and an exit status.
Why:
A conversion takes seconds to minutes per worktree and is bound by the filesystem’s metadata work, not by any one
worktree’s state, so the worktrees are converted side by side within a budget the host allows (parallel_budget.rs);
progress lines go to standard error as they happen for the first unfinished worktree, and every worktree’s lines come in
input order (parallel_runner.rs). Exit status 0 means every worktree is converted, already a subvolume, previewed, or
skipped under --all; 1 means a named worktree was refused before anything changed; 2 means a step failed after the
journal began, with the way forward. One worktree’s failure never stops another: each has its own journal and claim.
In TS you’d write (pseudocode):
const code = await executeConvert({ platform, args, cwd, interrupt, say });Structs§
- Convert
Run - What: Everything one run of the command needs besides the line sink. Why: The platform, the interrupt and the host’s resources are injected so the controls run the real command on any filesystem and with a host of any size.
Constants§
- CONVERSION_
MEMORY - What: The bytes one conversion holds at its peak, rounded up for a worktree of about two hundred thousand files. Why: The budget divides the free memory by it. A conversion holds the index entries and the tree-walk state of one worktree and streams the file data through the kernel’s clone call, so its peak follows the number of files and not their size: measured on 2026-11-03 at 7484 KiB resident for a worktree of 16 thousand files (about 0.45 KiB per file), which is about 90 MiB at two hundred thousand files.
- CONVERSION_
STORAGE_ CEILING - What: The most worktrees converted at once however many CPUs and bytes the host has. Why: The conversions are bound by the filesystem’s metadata work, which stops scaling past a point. Measured on 2026-11-03 on a btrfs volume (32 worktrees of about ten thousand files each, 28 threads, other sessions running, medians of three or more runs at 1, 2, 4, 8, 16 and 18 workers: 61, 35, 19, 14, 12 and 12 seconds; further runs at 12, 16 and 24 workers: 11 to 30, 11 to 16 and 16 to 18 seconds): more than sixteen workers were never faster.
- FAILED_
EXIT_ CODE - The exit status of a failure after the journal began.
- REFUSED_
EXIT_ CODE - The exit status of a refusal: a condition stood in the way of a named worktree and nothing was changed.
Functions§
- conversion_
workers - The workers a run of
lanesindependent conversions uses onhost, with the person’scap. - convert_
action - What:
The action of the command: help, a refusal, or the run on the real platform with progress on standard error.
Why:
The command reads
.gititself and calls the filesystem, and starts no Git. It still needs to know which Git the wrapper forwards to (real_git, resolved by the caller), because where that Git reads its system files from is a fact only that Git reports, and the wrapper’s own environment does not name it. - execute
- What:
Run the command over its targets and return the exit status; every line goes through
say. Why: The platform and the interrupt are injected so the controls run the real command on any filesystem. - execute_
run executewith the host’s resources chosen by the caller.