Expand description
PATH resolution of the real Git executable.
What:
Find the real Git executable on PATH without ever selecting this wrapper.
Why:
The wrapper is installed as git ahead of real Git;
forwarding needs the
first usable candidate that is not a cli-git wrapper.
In TS you’d write (pseudocode):
// const gitPath = resolveRealGit(processResolutionInputs()); // '/usr/bin/git'Re-exports§
pub use crate::real_git_resolution::RecordedGit;pub use crate::real_git_resolution::ResolvedGit;pub use crate::real_git_resolution::resolve_real_git;
Structs§
- Real
GitNot Found - What:
The failure when no PATH candidate can act as real Git.
usizecounts items; it is the length type of every Rust list.Vec<SearchedCandidate>is an owned list of owned records (siblings:&[T], a borrowed view). Why: The counts tell the user whether Git is missing or only wrappers were found, and the list and thePATHvalue name what was searched. The record owns text, so it is notCopy. - Resolution
Inputs - What:
Everything resolution reads from the process,
gathered into one value.
Vec<PathBuf>is an owned list of owned paths. Why: Tests inject a disposable PATH and executable identity instead of mutating the real process environment. - Searched
Candidate - What:
One PATH candidate the search examined and what it found.
CandidateKindis the verdict (real Git, wrapper, unusable). Why: The failure message lists every candidate with its verdict, so the person can see which entries led back to cli-git and which were not executable files at all.
Enums§
- Platform
- What:
Which operating-system family’s lookup rules apply.
#[derive(...)]generates copying, debug printing and==. Why: Executable names, conventional install locations and path identity differ by family; passing the family as a value keeps every branch testable on one host.
Constants§
- DEFAULT_
WINDOWS_ PATH_ EXTENSIONS - Windows executable extensions in shell lookup order when
PATHEXTis unset.
Functions§
- candidate_
sequence - What: Build the ordered, de-duplicated list of absolute candidates. Why: Every PATH directory contributes each executable name in order; conventional locations that PATH exposes are promoted to the front in their PATH spelling. Relative PATH entries are resolved against the current directory, as a shell does.
- common_
git_ paths - What:
List conventional Git install locations for a platform.
&[(OsString, OsString)]borrows the environment as name/value pairs. Why: A conventional location wins over an earlier PATH entry, so a straygitscript early on PATH cannot displace the system Git. Windows roots come from the environment; a trailing separator on a root is dropped before joining. - executable_
names - What:
List the file names PATH lookup tries,
in order.
Why:
Unix runs
git; Windows triesgitplus eachPATHEXTextension, adding a missing leading dot. An extension that is not UTF-8 cannot name a file portably and is skipped. - host_
platform - What:
The lookup rules of the platform this executable was compiled for.
cfg!(...)is a compile-timetrue/falseabout the target platform. Why: Production uses the host’s rules; tests pass a platform explicitly. - process_
resolution_ inputs - What:
Gather resolution inputs from the running process.
std::io::Result<T>isResult<T, std::io::Error>. Why: The wrapper must know its own executable to exclude it; if the operating system cannot report it (or the current directory), resolution fails rather than risk selecting itself. - search_
path_ for_ real_ git - What:
Select the first
PATHcandidate that is real Git.Result<PathBuf, RealGitNotFound>is the selected path or the typed failure. Why: Wrappers are skipped and counted, unusable entries are skipped, and the first remaining candidate in priority order is forwarded to. This is the search ofPATHalone; every start of Git goes throughresolve_real_git, which adds the recorded fallback.