Expand description
Which Git program to execute. Compiled into the host and, by path, into the independently built Axel memory service.
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 the host and the service deliberately follow different rules. Do not unify them:
- The host (
git_program) runs the Git the user’s shell runs: the firstPATHdirectory with agit, so Homebrew, Nix and MacPorts Git keep working. WherePATHreaches the shim it runs the developer Git the shim would have run (so aPATHwith/usr/binfirst still gets Apple’s Git), or skips the shim when there is no developer Git. With no Git onPATHat all it falls back to the developer Git. - The Axel service (
developer_git) never consultsPATH. The host spawns it with an empty environment (env_clear: noPATH, noDEVELOPER_DIR), so nothing the host inherits picks the program the verifier runs. It runs the developer Git the shim would choose in an empty environment, asxcrundid for it before: thexcode-selectchoice, then Xcode, then the Command Line Tools.
So the two can run different Gits (say Homebrew’s and Apple’s). Both only
run read-only rev-parse (Git 2.31 or newer), whose paths do not depend on
the Git build. A service Git that cannot read the repository (too old for
its format, say) makes the service fail closed with no scope, never yield a
different identity.
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.