Skip to main content

ask_git_version_cached

Function ask_git_version_cached 

Source
pub fn ask_git_version_cached(
    context: &GitContext,
    cache_directory: Option<&Path>,
) -> Result<GitRelease, String>
Expand description

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.

In TS you’d write (pseudocode):

async function askGitVersionCached(context, cacheDirectory?: string): Promise<[number, number, number]>;