Skip to main content

Module git_version

Module git_version 

Source
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 one

Constants§

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_version remembers this answer.
ask_git_version_cached
What: Ask for the Git version through the per-executable cache in cache_directory, starting git version only 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_version keeps 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 None for 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 version output, such as git 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.