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§
- Repository
Format - 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
configfile. 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 --listreads 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 --listreads that one file without includes, and the snapshot’slocalscope 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 answerNone, and the caller starts Git.