Function: magit-process-environment
magit-process-environment is a byte-compiled function defined in
magit-process.el.
Signature
(magit-process-environment)
Documentation
Prepend magit-git-environment to process-environment.
This is intended to be used in bindings directly around calls
to git. No copy of process-environment is created, because
there is no expectation that the binding is further modified.
On Windows (except on a remote system), prepend additional variables (whose values are calculated here), addressing path and glob incompatibilities.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20261101.2154/magit-process.el
(defun magit-process-environment ()
"Prepend `magit-git-environment' to `process-environment'.
This is intended to be used in bindings directly around calls
to git. No copy of `process-environment' is created, because
there is no expectation that the binding is further modified.
On Windows (except on a remote system), prepend additional
variables (whose values are calculated here), addressing path
and glob incompatibilities."
(cond
((file-remote-p default-directory)
`(,@magit-git-environment
,@process-environment))
;; The various w32 hacks are only applicable when running on the local
;; machine. A local binding of process-environment different from the
;; top-level value affects the environment used by Tramp.
(`(,@magit-git-environment
,@(and magit-githook-directory
(list
(concat "PATH="
;; Inspired by code setting magit-git-executable.
(or (and (eq system-type 'windows-nt)
(car (magit--early-process-lines
"cygpath" "-w" magit-githook-directory)))
magit-githook-directory)
path-separator
(getenv "PATH"))))
,@(cdr (assoc magit-git-executable magit--git-w32-path-hack))
,@(and magit-need-cygwin-noglob
(mapcar (lambda (var)
(concat var "=" (if-let ((val (getenv var)))
(concat val " noglob")
"noglob")))
'("CYGWIN" "MSYS")))
,@process-environment))))