Expand description
git cli-git migrate-to-subvolume: root discovery, modes and exit statuses.
What:
git cli-git migrate-to-subvolume: find the repository’s main checkout from the working directory, run the
requested mode (migrate, rollback, remove the old tree) and turn the result into an exit status and text.
Why:
The command runs for minutes (the real checkout took about sixteen minutes of passes), so progress lines go to
standard error as they happen; refusals and failures end with the cause and every way forward. Exit status 0 means
done, already done or previewed, 1 means a condition refused it before anything changed, and 2 means a step
failed after the journal began, with the instruction to run the command again or to roll back. The main checkout is
found by reading .git in process (a directory, or a gitfile naming the common directory), never by asking Git.
In TS you’d write (pseudocode):
const code = await execute({ platform, args, root, interrupt, say });Constants§
- REFUSED_
EXIT_ CODE - The exit status of a refusal: a condition stood in the way and nothing was changed.
Functions§
- execute
- What:
Run the requested mode against a root and return the exit status.
sayreceives every line; the platform and interrupt are injected so controls run it on any filesystem. Why: One function holds the status mapping, so the controls check the real command’s behavior. - main_
checkout_ root - What:
The main checkout of the repository that contains
start, found without starting Git. Why: Walk up to the first.git. A directory there marks the main checkout. A file there is a linked worktree’s gitfile (gitdir: <admin directory>); the administrative directory’scommondirnames the common directory, whose parent is the main checkout when the common directory is called.git. Anything else (a bare repository, a submodule, an unreadable gitfile) is reported, because converting the wrong directory would be harmful. - migrate_
action - What:
The action of
git cli-git migrate-to-subvolume: help, or the run from the working directory’s repository. Why: Progress goes to standard error live; the action carries only the exit status.