Expand description
The Git 2.56.0 option table of git clean and its deletion facts.
What:
The complete git clean option table of Git 2.56.0 and the deletion facts read
from it.
Why:
The linked-worktree policy guards a clean that can delete files.
Git’s last
--dry-run/--no-dry-run wins,
in clusters (-ndX) and abbreviations (--dry).
In TS you’d write (pseudocode):
// cleanChangesWorktree(parseCleanRegion(['-ndX'])) === falseStructs§
- Clean
Region - What:
Final-state facts of one
git cleanregion.boolis true or false. Why: The policy decides from the final dry-run state;interactiveis reported for its diagnostics.
Constants§
- CLEAN_
TABLE - What:
Rows of
options[]incmd_clean(builtin/clean.c:936-948), in source order.&[OptionSpec]is a borrowed table baked into the program;Nonein the long position means the option has only a letter. Why:-e/--excludetakes a value and isPARSE_OPT_NONEG;-d,-xand-Xhave no long spelling. - DRY_RUN
-n,--dry-run.- INTERACTIVE
-i,--interactive.
Functions§
- clean_
changes_ worktree - What:
Whether the clean can delete files.
&CleanRegionborrows the facts. Why: Everyunlinkandrmdirin Git’s clean is skipped under dry run, also after the interactive menu chose what to delete (builtin/clean.c:191, 223, 267, 1050-1078). Gotcha: Divergence from the incumbent, which treated every interactive clean as deleting:git clean -i -ndeletes nothing in Git 2.56.0. - parse_
clean_ region - What:
Parse the region after
clean.Result<A, B>is “either successAor failureB”. Why: A region Git itself would refuse yields the refusal; Git then deletes nothing.