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 Git 2.56.0,
and the
owner settled on 2.55.0 as the oldest release that runs the swap,
so 2.55.0 or newer counts as supported and that read-only commands are never checked
(doc/handover/cli-git-rust-implementation.md,
“Adopted without a question”).
In TS you’d write (pseudocode):
await requireSupportedGit({ gitPath }); // onceConstants§
- MINIMUM_
GIT_ VERSION - The oldest supported Git release.
Functions§
- ask_
git_ version - What:
Ask Git its version and decide support,
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 supported Git, 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. - 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 an unsupported or unreadable Git. 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.