perf(magit): use /usr/bin/git on macos

Inexplicably, the built-in git on MacOS is many orders of magnitude
faster than the external builds provided by Homebrew/Macports, so use
that there. Emacs on MacOS needs all the (performance) help it can get
and, fortunately, the bundled git is 2.23 or newer on (at least) MacOS
10.15 (Catalina) and newer, so this should be a relatively safe bet
without the need for version checks.
This commit is contained in:
Henrik Lissner 2026-03-04 17:24:50 -05:00
parent d23bbe8772
commit d23abed66d
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -71,7 +71,14 @@ FUNCTION
;; enough that a non-absolute path can notably slow it down,
;; especially on MacOS and Windows, so I resolve it once, the first
;; time it's needed.
magit-git-executable (or (executable-find magit-git-executable) "git"))
magit-git-executable (or
;; PERF: Inexplicably, the built-in git on MacOS
;; is much faster than the one provided by
;; homebrew, so use that instead there.
(and (featurep :system 'macos)
(file-exists-p! "/usr/bin/git"))
(executable-find magit-git-executable)
"git"))
;; Turn ref links into clickable buttons.
(add-hook 'magit-process-mode-hook #'goto-address-mode)