Avoid some unnecessary refreshes.

* magit.el (magit-refresh-wrapper): Only revert files and refresh
status buffer when there is at least one buffer in need of refresh.
This commit is contained in:
Marius Vollmer 2008-10-02 01:18:25 +03:00
parent 1f74c1b0c1
commit fcfc70c136

View file

@ -987,14 +987,16 @@ Please see the manual for a complete description of Magit.
(defun magit-refresh-wrapper (func)
(if magit-refresh-pending
(funcall func)
(let ((magit-refresh-needing-buffers
(list (magit-find-buffer 'status default-directory)))
(let ((status-buffer (magit-find-buffer 'status default-directory))
(magit-refresh-needing-buffers nil)
(magit-refresh-pending t))
(unwind-protect
(funcall func)
(magit-revert-buffers)
(dolist (b magit-refresh-needing-buffers)
(magit-refresh-buffer b))))))
(when magit-refresh-needing-buffers
(magit-revert-buffers)
(dolist (b (adjoin status-buffer
magit-refresh-needing-buffers))
(magit-refresh-buffer b)))))))
(defun magit-need-refresh (&optional buffer)
(let ((buffer (or buffer (current-buffer))))