Expand description
Converting a main checkout into a btrfs subvolume, resumably.
What:
Convert a main checkout into a btrfs subvolume at the same path, in process, resumably.
Why:
The steps are those of the proven script (doc/handover/cli-git-subvolume-migration-script.md), without any
program started: create <root>.subvol-new as a subvolume; create the linked worktrees inside it as nested
subvolumes; copy the tree with cloned data; repeat the copy as a delta; hold .git/index.lock, run the last
delta and swap the two directories in one atomic step; rename the old tree aside; carry over files newer in the
old tree; rewrite the Git index stat fields; verify. Each step is recorded in the journal (subvolume_journal.rs),
so a rerun after a kill at any point resumes: a finished step is skipped and an unfinished one is repeated, and all
of them are idempotent. The old tree is never deleted here.
In TS you’d write (pseudocode):
const verdict = await migrate({ platform, root, options, interrupt, say });Structs§
- Migrate
Options - What:
What the person asked for the migration to do.
Why:
The two switches are the script’s
--no-nested-worktreesand--no-refresh-indexes; the dry run previews.
Enums§
- Verdict
- What: How a migration command ended, when it did not fail. Why: The command maps each to an exit status and the closing text.
Functions§
- migrate
- What:
Run the whole migration command: preflight, preview or steps.
sayreceives progress lines as they happen. Why: A refusal returns before anything is created. A finished migration or a plain subvolume with no journal returnsAlreadyDone. Any failure after the first step leaves the journal so a rerun resumes, and the error says so.