Skip to main content

Module shadow_config

Module shadow_config 

Source
Expand description

The shadow repository config file and the copied repository format. What: The shadow repository’s config file, written by cli-git itself, and the repository format facts it copies from the real common config. Why: Git does not apply core.repositoryformatversion and extensions.* from an included file, so they are copied explicitly. The shadow names no hooks directory (traditional hooks are unsupported, and every shadow command passes its own core.hooksPath); core.worktree, gc.auto and maintenance.auto follow the include, so the real config cannot redirect the worktree or start maintenance in the shadow (src/shadow-repository/shadow-config.ts).

In TS you’d write (pseudocode):

formatShadowConfig({ format, commonDir, worktreeRoot });

Structs§

RepositoryFormat
What: Repository format facts the shadow copies from the real common config. Why: A shadow with a different object format or ref backend would misread the real store.

Functions§

format_shadow_config
What: Formats the shadow config file. Why: The line order is the incumbent’s, minus its hooks path: format facts, the include, then the worktree, gc and maintenance overrides.
quote_git_config_value
What: Quotes one value under Git’s config syntax. Why: The value is always double-quoted, so ;, # and surrounding whitespace stay literal; backslash, double quote, newline and tab use Git’s escapes.
read_repository_format
What: Reads the format facts from the real common config file alone. Why: git config --file config --list reads only that file, so an included or worktree config never leaks into the copied format.
repository_format_from_snapshot
What: The format facts from the configuration snapshot, when its local entries are exactly the common config file. Why: git config --file config --list reads that one file without includes, and the snapshot’s local scope is that file plus whatever it includes; with no include key anywhere, and a read made without global options, the two lists are the same entries in the same order, so the facts are the same. Any include key makes the answer None, and the caller starts Git.