Skip to main content

Module command_branch_create

Module command_branch_create 

Source
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'] }).createsBranch

Structs§

BranchCreationRegion
What: Facts of one guarded region. Option<usize> is “a token index or nothing”. Why: implicit_creation_target names the argument a repository probe must check against remote branches; this module never runs that probe.

Enums§

BranchCreationCommand
What: The guarded subcommands. An enum is 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 success A or failure B”. Why: A region Git itself would refuse yields the refusal; Git then creates nothing.