Skip to main content

Module git_program

Module git_program 

Source
Expand description

Which Git program the host executes.

On macOS /usr/bin/git is Apple’s xcrun shim. Without the Command Line Tools, executing it opens the “install developer tools” dialog, and GIT_TERMINAL_PROMPT=0 does not prevent that. So on macOS Synaps never runs the shim: it runs a Git by absolute path, or treats Git as unavailable. Every other platform runs plain git from PATH, as before.

On macOS git_program runs the Git the user’s shell runs: the first PATH directory with a git, so Homebrew, Nix and MacPorts Git keep working. Where PATH reaches the shim it runs the developer Git the shim would have run (so a PATH with /usr/bin first still gets Apple’s Git), or skips the shim when there is no developer Git. When PATH has no usable Git it falls back to developer_git: the xcode-select choice, then Xcode, then the Command Line Tools. The two follow different rules because developer_git stands for what the shim would run, which never depends on PATH.

Structs§

GitUnavailable
macOS has no Git: none on PATH and no developer Git (Apple’s Command Line Tools are not installed).

Functions§

developer_git
Plain git, found on PATH, exactly as before (only macOS resolves).
git_program
Plain git, found on PATH, exactly as before (only macOS resolves).
is_real_git
A Git that may be run: following symlinks, an executable regular file that is not the /usr/bin/git shim.
is_shim
git is, or links to, the /usr/bin/git shim.
resolve_developer_git
The macOS developer Git. Pure (the caller supplies DEVELOPER_DIR, the target of /var/db/xcode_select_link and the file test), so it builds and is tested on every platform. Candidate directories, in order:
resolve_path_git
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.