Skip to main content

Module config_file

Module config_file 

Source
Expand description

Repository-root discovery and bounded reading of cli-git.config.jsonc. What: Find and read cli-git.config.jsonc at a repository root. Why: Configuration is one data file at one fixed place; legacy executable configuration is reported for migration and never read, run or silently ignored.

In TS you’d write (pseudocode):

// loadRepositoryConfig(root) returns { config, source, ignoredLegacy } or throws ConfigError.

Structs§

LoadedConfig
What: The outcome of loading one repository’s configuration. Option<PathBuf> is “an owned path or nothing”; Vec<PathBuf> is an owned list. Why: Callers need the settings, the file they came from for diagnostics, and any legacy file that was left beside an authoritative JSONC file so they can report it instead of ignoring it silently.

Constants§

CONFIG_FILE_NAME
The only configuration file the native wrapper reads.
LEGACY_CONFIG_FILE_NAMES
What: Executable configuration names of the TypeScript wrapper, in its lookup order. &[&str] is a borrowed list of borrowed strings compiled into the executable. Why: Their presence must produce a migration diagnostic.
MAX_CONFIG_BYTES
What: Largest accepted configuration file, one mebibyte. u64 is an unsigned 64-bit integer, the type of file sizes (sibling usize). Why: A repository file must not control how much memory every Git command reads.

Functions§

ignored_legacy_notice
What: Describe a legacy file that sits beside an authoritative JSONC file. String is owned text returned to the caller. Why: The executable prints this so the stale file is never ignored silently.
load_repository_config
What: Load the configuration of the repository whose top level is repository_root. Why: This is the single entry point for policy settings. Nothing in a repository is executed: the JSONC file is parsed as data, and legacy .mjs/.ts configuration is only detected by name.