Configuration in grit-lib follows Git’s cascade (system, global, local, worktree, and environment overrides). Prefer Repository::config_handle for hot paths: it returns ConfigHandle, which reads the same merged snapshot as Repository::config and can update the repository-local file.
Loading outside a handle
ConfigSet::load parses the cascade from disk given an Environment and optional git directory. The library does not read std::env during load — embedders pass variables explicitly (see Embedding and Repository).
Local writes
ConfigHandle::set_local writes one key to the repository-local config (or commondir/config for linked worktrees without a per-worktree config file), then reloads the in-memory snapshot on the open Repository.