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
PATHand no developer Git (Apple’s Command Line Tools are not installed).
Functions§
- developer_
git - Plain
git, found onPATH, exactly as before (only macOS resolves). - git_
program - Plain
git, found onPATH, 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/gitshim. - is_shim
gitis, or links to, the/usr/bin/gitshim.- resolve_
developer_ git - The macOS developer Git. Pure (the caller supplies
DEVELOPER_DIR, the target of/var/db/xcode_select_linkand 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.