Skip to main content

resolve_path_git

Function resolve_path_git 

Source
pub fn resolve_path_git(
    path: Option<&OsStr>,
    is_git: impl Fn(&Path) -> bool,
    is_shim: impl Fn(&Path) -> bool,
    developer_git: impl FnOnce() -> Option<PathBuf>,
) -> Option<PathBuf>
Expand description

The macOS host Git. Pure (the caller supplies PATH, the file tests and the developer Git), so it builds and is tested on every platform.

Walks the absolute directories of path in order. The first <dir>/git that is_git accepts wins. One that is_shim recognises stands for developer_git() (asked at most once): what the shim would run, if there is one; otherwise the walk goes on. After the walk, developer_git(). Relative and empty entries (the current directory) are skipped, and the result is never /usr/bin/git.