Function: magit-run-git-with-input
magit-run-git-with-input is a byte-compiled function defined in
magit-process.el.
Signature
(magit-run-git-with-input &rest ARGS)
Documentation
Call Git in a separate process.
ARGS is flattened and then used as arguments to Git.
The current buffer's content is used as the process's standard input. The buffer is assumed to be temporary and thus OK to modify. Return the exit code.
Function magit-git-executable(var)/magit-git-executable(fun) specifies the Git executable and
option magit-git-global-arguments specifies constant arguments.
The remaining arguments ARGS specify arguments to Git, they are
flattened before use.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-process.el
(defun magit-run-git-with-input (&rest args)
"Call Git in a separate process.
ARGS is flattened and then used as arguments to Git.
The current buffer's content is used as the process's standard
input. The buffer is assumed to be temporary and thus OK to
modify. Return the exit code.
Function `magit-git-executable' specifies the Git executable and
option `magit-git-global-arguments' specifies constant arguments.
The remaining arguments ARGS specify arguments to Git, they are
flattened before use."
(when (eq system-type 'windows-nt)
;; On w32, git expects UTF-8 encoded input, ignore any user
;; configuration telling us otherwise (see #3250).
(encode-coding-region (point-min) (point-max) 'utf-8-unix))
(cond
((file-remote-p default-directory)
;; We lack `process-file-region', so fall back to asynch +
;; waiting in remote case.
(magit-start-git (current-buffer) args)
(while (and magit-this-process
(eq (process-status magit-this-process) 'run))
(sleep-for 0.005)))
(t
(run-hooks 'magit-pre-call-git-hook)
(pcase-let* ((process-environment (magit-process-environment))
(default-process-coding-system (magit--process-coding-system))
(flat-args (magit-process-git-arguments args t))
(`(,process-buf . ,section)
(magit-process-setup (magit-git-executable) flat-args))
(inhibit-read-only t))
(magit-process-finish
(apply #'call-process-region (point-min) (point-max)
(magit-git-executable) nil process-buf nil flat-args)
process-buf nil default-directory section)))))