Expand description
The Git version check run once before work that depends on Git’s behavior.
What:
The real Git version check,
run once per invocation before work that depends on Git’s
behavior:
a commit,
hooks and locks.
Why:
The native tables and protocols follow the Git release the test image runs the tests with,
and a Git older than that release is not refused:
the owner chose to warn once and go on
(“Raise minimum, drop the test, merely print a warning on older git and not refuse.”,
2026-11-04),
so the constant below is the release the wrapper was tested with.
Only a Git whose release cannot be read stops the command,
because nothing is known about it.
Read-only commands are never checked
(doc/handover/cli-git-rust-implementation.md,
“Adopted without a question”;
that section moved on 2026-11-03 to
doc/planning/cli-git-rust-open-decisions.md).
In TS you’d write (pseudocode):
await requireReadableGit({ gitPath }); // once; warns when the release is older than the tested oneConstants§
- MINIMUM_
GIT_ VERSION - The Git release the wrapper was tested with, and the minimum below which every run prints a warning.
Functions§
- ask_
git_ version - What:
Ask Git its version without the cache.
Why:
check_git_versionremembers this answer. - ask_
git_ version_ cached - What:
Ask for the Git version through the per-executable cache in
cache_directory, startinggit versiononly on a miss. Why: The text is read from the cache only when the executable’s identity matches the recorded one exactly and the text still parses; a stale, unreadable or absent entry, an executable that is not identifiable, or no cache directory all run Git. The identity is taken before the start and again after it, and the text is recorded only when both agree and Git succeeded, so an executable replaced during the start is never recorded under the old identity. - check_
git_ version - What: Require a Git whose release can be read, asking at most once per process. Why: The check costs a Git process, so later dependent steps reuse the answer.
- check_
once - What:
Return the answer already stored in
cell, or ask once and store the answer. Why:check_git_versionkeeps one answer per process; a separate cell lets the controls prove the ask runs once without sharing the process-wide answer. - older_
git_ warning - What:
The warning for a Git older than the release the wrapper was tested with,
or
Nonefor that release and every later one. Why: An older Git is not refused; the person learns which Git was found, which release the wrapper was tested with, and that the command continues. - parse_
git_ version - What:
The release numbers of
git versionoutput, such asgit version 2.56.0.windows.1. Why: Only the first three dotted numbers decide support; platform suffixes vary. - unsupported_
message - What: The message for a Git whose release cannot be read. Why: The person must know which Git was asked and what to do.
Type Aliases§
- GitRelease
- A Git release as its major, minor and patch numbers.