Commit e62aff3f authored by Noam Postavsky's avatar Noam Postavsky

magit-run-git-with-input: run synchronously

We were running asynchronously in order to pass input, but
call-process-region allows to passing input synchronously.  There is no
file handler respecting equivalent for call-process-region (like
call-process and process-file), so keep using asynchronous process +
wait in case we're running over tramp.
parent a517571b
......@@ -331,13 +331,22 @@ flattened before use.
After Git returns, the current buffer (if it is a Magit buffer)
as well as the current repository's status buffer are refreshed.
When INPUT is nil then do not refresh any buffers.
This function actually starts a asynchronous process, but it then
waits for that process to return."
When INPUT is nil then do not refresh any buffers."
(declare (indent 1))
(magit-start-git (or input (current-buffer)) args)
(magit-process-wait)
(if (file-remote-p default-directory)
;; We lack `process-file-region', so fall back to asynch +
;; waiting in remote case.
(progn
(magit-start-git (or input (current-buffer)) args)
(while (and magit-this-process
(eq (process-status magit-this-process) 'run))
(sleep-for 0.005)))
(with-current-buffer (or input (current-buffer))
(let ((process-environment (append (magit-cygwin-env-vars)
process-environment)))
(apply #'call-process-region (point-min) (point-max)
magit-git-executable nil nil nil
(magit-process-git-arguments args)))))
(when input (magit-refresh)))
(defvar magit-this-process nil)
......@@ -701,11 +710,6 @@ as argument."
(add-hook 'magit-credential-hook #'magit-maybe-start-credential-cache-daemon)
(defun magit-process-wait ()
(while (and magit-this-process
(eq (process-status magit-this-process) 'run))
(sleep-for 0.005)))
(defun tramp-sh-handle-start-file-process--magit-tramp-process-environment
(fn name buffer program &rest args)
(if magit-tramp-process-environment
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment