Skip to main content

Module command_config

Module command_config 

Source
Expand description

The form and file scope of a git config region. What: The form and file scope of a git config region, read as Git 2.56.0 reads it. Why: The require-root policy exempts git config when it works on the per-user or system file, or lists. Whether --global is that option or a value being stored depends on the form: git config user.name --global writes the text --global into the repository’s own configuration.

Gotcha: Git also refuses two different actions of the form without a subcommand word (--list --get); that conflict is not modeled, so such a region still reports its listing. Git then runs nothing.

In TS you’d write (pseudocode):

// parseConfigRegion(['--global', 'user.name']).global === true
// parseConfigRegion(['user.name', '--global']).global === false

Structs§

ConfigRegion
What: Facts of one git config region. Vec<WrapperOccurrence> is an owned growable list of wrapper-only flags. Why: The require-root decision reads the scope and the listing action; the caller removes its wrapper-only flags by the positions reported here.

Enums§

ConfigForm
What: The form cmd_config dispatches to (builtin/config.c:1633-1660). An enum is a closed set of named alternatives. Why: Legacy is the form without a subcommand word, where actions are options such as --list and --get.

Functions§

config_table
What: The complete option table of one form, assembled from Git’s groups in Git’s order. Vec<OptionSpec> is an owned list, built once per parse. Why: The completion control compares each assembled table with the binary’s.
parse_config_region
What: Parse the region after git config. Result<A, B> is “either success A or failure B”; wrapper_flags are the caller’s wrapper-only spellings. Why: Git looks at the first token only to pick the form. A subcommand word selects its table; a leading -- is dropped by that first look, so the form without a subcommand then reads the rest as options again (config.c:1643-1660). Leading wrapper flags are skipped first, because the wrapper removes them before Git runs: git config --cli-git-keep-going list reaches Git as git config list.