Expand description
Reading configuration — and reading it the way git itself does.
Everything this project can be tuned with is a git config key, so the
honest implementation of that promise is to let git do the parsing.
git config --type=bool implements git-config(1) by definition: on,
yes, 1, an empty value, and every capitalisation of each. A hand-rolled
matches!(v, "true" | "1" | "yes") is our own dialect wearing git’s
clothes, and it had already drifted — git config greengate.fix on looked
like it worked and did not.
The exit code carries the part that matters most:
| exit | means |
|---|---|
| 0 | the key is set, and stdout is git’s normalised value |
| 1 | the key is not set anywhere git looked |
| 128 | the key is set to something git refuses to parse, and said so on stderr |
Collapsing 1 and 128 into “no” is the bug this module exists to prevent: a
limit you believe you raised and did not is exactly the silent-config
failure that hook.skip announcements were introduced for. So a bad value
falls back to the shipped default and says so, once per key per run.
Structs§
- Settings
- Everything this process resolved once about configuration: the trusted repository policy, and the reads memoised on top of it.
Enums§
- Quiet
Override amont run --quietor--raw.- Scope
- Where a key’s value came from, for the commands whose job is reading configuration back.
- Value
- What a key said. Three answers, because “unset” is a state this project
makes decisions with —
greengate.commit.gitmojihas four meanings and one of them is absence.
Functions§
- boolean
- boolean_
or - complain
- enumerated
- One of a fixed set of words, compared case-insensitively.
- enumerated_
or - host_
env_ name greengate.idleLoadScale→GREENGATE_IDLE_LOAD_SCALE: the environment name a host key answers to.- host_
integer_ or - A HOST key: a setting that describes the machine — how many heavy checks
it runs at once, how far its load may stretch a budget — and so is read
from
--globalor--systemconfig only (ADR-0009). A value set in a repository is ignored with one warning naming the scope to use: two repositories that disagreed about the host’s slot count would each take slots the other never sees. An environment variable named after the key (greengate.idleLoadScale→GREENGATE_IDLE_LOAD_SCALE) outranks both, which is the precedencecli.config.precedencegives it: flag or environment, then the person’s config, then the system’s, then the default. Theamont.confpolicy ladder does not apply: a committed file cannot set a host key. - host_
rows - The
greengate.*rows ofgit config --show-scope, as (scope, lowercased key, value): one scan perSettings, shared by every host key read and by the slots crate’sHostSizing::resolve.Nonewhen git cannot report config scopes. - integer
- An integer, in git’s own spelling — which includes the
k/m/gsuffixes git accepts, since--type=intexpands them before we see them. - integer_
or - An integer, clamped to what the setting can actually mean.
- is_
present - Is
keyamong the namespresentreturned? Case-insensitive, because git config key names are. - present
- Which keys under
prefixare set at all — one git call for the whole family. - scope_
of git config --show-origin --get <key>→ which file it came from.- string_
value - Say once, per key, that a configured value could not be used.