Expand description
Branch-creation facts of git branch,
git checkout and git switch.
What:
Branch-creation facts of git branch,
git checkout and git switch regions,
read as Git 2.56.0 reads them.
Why:
The branch-worktree policy rejects creating a branch in the current worktree.
It
needs the explicit forms and the name Git may turn into a new local branch by
matching a remote branch,
for every spelling Git accepts.
Gotcha:
The facts read option names and argument counts only.
Where Git later refuses
for an option value,
a combination of options,
configuration or repository
state,
the answer stays “creates”:
it errs toward the policy seeing the command.
In TS you’d write (pseudocode):
// parseBranchCreationRegion({ subcommand: 'switch', postSubcommandArgs: ['-c', 'topic'] }).createsBranchStructs§
- Branch
Creation Region - What:
Facts of one guarded region.
Option<usize>is “a token index or nothing”. Why:implicit_creation_targetnames the argument a repository probe must check against remote branches; this module never runs that probe.
Enums§
- Branch
Creation Command - What:
The guarded subcommands.
An
enumis a closed set of named alternatives. Why: Each has its own option table and its own rule for what a positional name means.
Functions§
- branch_
creation_ command - What:
The guarded command a subcommand word names,
or nothing.
&[u8]borrows the word. Why: Callers hold the subcommand token as raw bytes. - parse_
branch_ creation_ region - What:
Parse the region after a guarded subcommand.
Result<A, B>is “either successAor failureB”. Why: A region Git itself would refuse yields the refusal; Git then creates nothing.