Skip to main content

get

Function get 

Source
pub fn get(
    cwd: &Path,
    scope: ConfigScope,
    key: &str,
) -> Result<Option<String>, Error>
Expand description

Read a single config value from the given scope. Returns Ok(None) if the key isn’t set, or if the scope itself isn’t readable here: git config --local exits 128 outside any repo, exits 129 (“only one config file at a time”) when GIT_CONFIG is also set, and any scope exits 128 when env-vars like GIT_WORK_TREE point at a missing path. Treating all of those as “no value” matches upstream’s cfg.Git.Get(key) semantics — git lfs env distinguishes a configured value from an unconfigured one, but not between “key not set” and “scope unreachable.”