Expand description
Automatic maintenance decision: config record parsing and the enable and detach rules.
What:
The decision behind automatic maintenance after a landing:
parsing git config --null --get-regexp records,
and choosing whether git maintenance run --auto runs and whether it detaches.
Why:
Native git commit runs this step after updating HEAD;
a landing replaces that commit with plumbing,
so the pack count grows by one per commit unless this step runs.
The rules mirror Git’s prepare_auto_maintenance in run-command.c,
including JavaScript number semantics for values the incumbent reads with Number(...).
In TS you’d write (pseudocode):
const args = autoMaintenanceArgs(parseConfigRecords(output));Enums§
- Maintenance
Decision - What: The arguments automatic maintenance runs, or the fact that configuration turned it off. Why: The incumbent’s disabled marker is a symbol; an enum keeps the two outcomes distinct without a sentinel value.
- Maintenance
Error - What: Why automatic maintenance could not be decided or run. Why: Each variant is a failure the caller can name; a start failure is kept as text so the error stays comparable in tests.
Constants§
- MAINTENANCE_
CONFIG_ PATTERN - The config key pattern the decision reads, as
git config --get-regexpmatches it. Keys are canonicalized as Git prints them.
Functions§
- auto_
maintenance_ arguments - What:
The arguments native
git commitwould givegit maintenance run, orDisabledwhen configuration turns automatic maintenance off. Why:maintenance.autotakes precedence overgc.auto; the detach setting follows the same precedence. Detaching is the default, as in Git. - parse_
config_ records - What:
Parse
git config --type=bool-or-int --null --get-regexpoutput into canonical key to value. A record without a newline is a key with no value, which Git reads astrue. Why: Git prints one NUL-terminated record per key occurrence; the last occurrence wins, as Git’s single-value lookup does.