Skip to main content

parse_config_count

Function parse_config_count 

Source
pub fn parse_config_count(value: &OsStr) -> Option<u64>
Expand description

What: Parse GIT_CONFIG_COUNT exactly as Git 2.56.0 config.c does with strtoul(env, &endp, 10) followed by its *endp and INT_MAX checks. Option<u64> is Some(count) when Git accepts the value, None when Git would report “bogus count” or “too many entries”. Why: The overlay must append after the entries Git will really read, and must leave a value Git rejects untouched so Git reports the caller’s own mistake. strtoul skips leading whitespace and accepts one sign; a negated nonzero value wraps above INT_MAX, so only -0 survives with a minus sign.

In TS you’d write (pseudocode):

function parseConfigCount(value: string): number | undefined;