Skip to main content

Module forwarded_command

Module forwarded_command 

Source
Expand description

The Git command a forwarded invocation runs, after ordinary alias expansion. What: The Git command a forwarded invocation actually runs, after ordinary alias expansion. Why: Git expands an alias only when no built-in has that name, reads it from alias.<name> or alias.<name>.command, splits it with split_cmdline quoting, lets its leading words be global options, and expands again when the result is an alias. Index-writer coordination and the commit rules decide from the expanded command, so git -c alias.c=commit c is a commit (src/forwarded-command.ts).

In TS you’d write (pseudocode):

const command = await resolveForwardedCommand({ args, gitPath });

Structs§

ResolvedCommand
What: The resolved command: the arguments after expansion, where the subcommand is, its name, and the route. Why: ResolvedGitCommand.

Enums§

Route
What: How the command was reached. Why: A shell alias or an unresolved name is never classified as a built-in.

Constants§

MAX_ALIAS_EXPANSIONS
Alias expansions followed before giving up, well above any realistic chain.

Functions§

creates_or_moves_worktrees
What: Whether a resolved command creates or moves linked worktrees. Why: createsOrMovesWorktrees: git worktree add and git worktree move, decided by the first positional token after worktree.
lookup_alias
What: An alias value in either of Git’s spellings, alias.<name> first. Why: lookupAlias.
resolve_forwarded_command
What: Resolve the command a forwarded invocation runs, expanding aliases up to MAX_ALIAS_EXPANSIONS times; a built-in name starts no Git process. Why: resolveForwardedCommand.
split_alias_command
What: Split an alias value as Git’s split_cmdline does: whitespace separates words outside quotes, single and double quotes group, and a backslash escapes the next byte except inside single quotes. None is an unclosed quote or a trailing backslash. Why: splitAliasCommand; bytes are kept as they are.
trim_alias_value
What: An alias value with surrounding whitespace removed, as JavaScript’s .trim() does for text; a value that is not UTF-8 loses only ASCII whitespace. Why: The incumbent trims git config --get output, newline included, before splitting.