Commit a517571b authored by Noam Postavsky's avatar Noam Postavsky

magit-run-git-with-logfile: run synchronously

By passing (:file FILE) as output, we can avoid the need for a special
process filter, and having to wait for an asynchronous process to finish.
parent 50e8b529
......@@ -126,11 +126,8 @@ bisect run'."
(unless (or no-assert (magit-bisect-in-progress-p))
(user-error "Not bisecting"))
(magit-with-toplevel
(let ((file (magit-git-dir "BISECT_CMD_OUTPUT")))
(ignore-errors (delete-file file))
(magit-run-git-with-logfile file "bisect" subcommand args))
(magit-process-wait)
(magit-refresh)))
(magit-run-git-with-logfile
(magit-git-dir "BISECT_CMD_OUTPUT") "bisect" subcommand args)))
(defun magit-bisect-in-progress-p ()
(file-exists-p (magit-git-dir "BISECT_LOG")))
......
......@@ -344,12 +344,9 @@ waits for that process to return."
(defun magit-run-git-with-logfile (file &rest args)
"Call Git in a separate process and log its output to FILE.
See `magit-run-git' for more information.
This function might have a short halflive."
(magit-start-git nil args)
(process-put magit-this-process 'logfile file)
(set-process-filter magit-this-process 'magit-process-logfile-filter)
(magit-process-wait)
(apply #'magit-process-file magit-git-executable nil `(:file ,file) nil
(magit-process-git-arguments args))
(magit-refresh))
;;; Asynchronous Processes
......@@ -597,17 +594,6 @@ Magit status buffer."
(insert (substring string (1+ ret-pos)))))
(set-marker (process-mark proc) (point)))))
(defun magit-process-logfile-filter (process string)
"Special filter used by `magit-run-git-with-logfile'."
(magit-process-filter process string)
(let ((file (process-get process 'logfile)))
(with-temp-file file
(when (file-exists-p file)
(insert-file-contents file)
(goto-char (point-max)))
(insert string)
(write-region (point-min) (point-max) file))))
(defmacro magit-process-kill-on-abort (proc &rest body)
(declare (indent 1) (debug (form body)))
(let ((map (cl-gensym)))
......
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