Skip to main content

Module config

Module config 

Source
Expand description

Get, set, and unset git config values, scoped to one of git’s config files.

Enums§

ConfigScope
Which config file git config operates on.

Functions§

get
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.”
get_effective
Look up key across .lfsconfig (committed; lowest priority) and the standard git config scopes (local → global → system). Returns the first match.
get_from_file
Read a single config value from a specific file (e.g. .lfsconfig). Returns Ok(None) if the file doesn’t exist or the key isn’t set.
get_from_lfsconfig
Look up key in .lfsconfig, applying the safe-key allowlist.
set
Set key = value in the given scope.
unset
Unset key in the given scope. Idempotent: if the key isn’t there, returns Ok(()) rather than erroring.