Skip to main content

parse_config_region

Function parse_config_region 

Source
pub fn parse_config_region(
    region: &[OsString],
    wrapper_flags: &[&[u8]],
) -> Result<ConfigRegion, OptionError>
Expand description

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.

In TS you’d write (pseudocode):

function parseConfigRegion(region: string[], wrapperFlags: string[]): ConfigRegion; // throws OptionError