Skip to main content

Module git_system_config

Module git_system_config 

Source
Expand description

The system configuration file a real Git executable reads, learned once per executable identity. What: The system configuration file that one real Git executable reads when GIT_CONFIG_SYSTEM is not set, learned once per executable identity and cached beside the git version cache. Why: Git compiles the path in (ETC_GITCONFIG, /etc/gitconfig for a build with prefix /usr, and under the prefix for any other build, resolved against the executable’s own location in a runtime-prefix build), so no reader may assume /etc/gitconfig. git var GIT_CONFIG_SYSTEM prints the path the executable would read, with the environment’s own overrides removed from its start, so the path is a property of the executable’s bytes and location, which the identity of git_version_cache captures. An executable without an identity (a script, a shim) or an answer that is not an absolute path is unknown, and the readers then leave the question to Git.

In TS you’d write (pseudocode):

const path = cached(identity, 'git-system-config') ?? (await run(realGit, ['var', 'GIT_CONFIG_SYSTEM'])); // undefined: unknown

Constants§

SYSTEM_CONFIG_KIND
The kind of the cache file that holds the compiled-in system configuration path.

Functions§

parse_path_line
What: The path text git var GIT_CONFIG_SYSTEM printed, when it is one absolute path on one line. Why: Any other output (nothing, a relative path, several lines) is not a fact the readers can use.
system_config_for
What: The system configuration path the Git a child would run reads, learned from the forward-target variable the wrapper puts in every child’s environment. Why: None (no variable, no identity, no answer) makes the readers decline whenever the system file would be read.
system_config_of
What: The system configuration path of the executable at real_git: from the cache when the identity matches, otherwise from ask, recorded for the next start. Why: The question runs once per executable; ask is a parameter so a control can count the starts and give a Git whose prefix is not /usr.
with_real_git
What: variables with the forward-target variable added for real_git when the variables do not name one. Why: The wrapper process learns the system configuration path from the real Git named by that variable. The environment entry.rs builds always carries it, but a resident process (the service) and callers that hold only a Git path and a bare overlay do not, and without it every read there would decline; the caller knows the Git it runs.