Only revert buffers that belong to the current repo.

This commit is contained in:
Marius Vollmer 2009-07-28 00:21:34 +03:00
parent 3731a18b49
commit 31b8be948a

View file

@ -1332,9 +1332,14 @@ Please see the manual for a complete description of Magit.
(set-window-point w (point))) (set-window-point w (point)))
(magit-highlight-section))))) (magit-highlight-section)))))
(defun magit-revert-buffers () (defun magit-string-has-prefix-p (string prefix)
(eq (compare-strings string nil (length prefix) prefix nil nil) t))
(defun magit-revert-buffers (dir)
(dolist (buffer (buffer-list)) (dolist (buffer (buffer-list))
(when (and buffer (when (and buffer
(buffer-file-name buffer)
(magit-string-has-prefix-p (buffer-file-name buffer) dir)
(not (verify-visited-file-modtime buffer)) (not (verify-visited-file-modtime buffer))
(not (buffer-modified-p buffer))) (not (buffer-modified-p buffer)))
(with-current-buffer buffer (with-current-buffer buffer
@ -1347,13 +1352,14 @@ Please see the manual for a complete description of Magit.
(defun magit-refresh-wrapper (func) (defun magit-refresh-wrapper (func)
(if magit-refresh-pending (if magit-refresh-pending
(funcall func) (funcall func)
(let ((status-buffer (magit-find-buffer 'status default-directory)) (let* ((dir default-directory)
(status-buffer (magit-find-buffer 'status dir))
(magit-refresh-needing-buffers nil) (magit-refresh-needing-buffers nil)
(magit-refresh-pending t)) (magit-refresh-pending t))
(unwind-protect (unwind-protect
(funcall func) (funcall func)
(when magit-refresh-needing-buffers (when magit-refresh-needing-buffers
(magit-revert-buffers) (magit-revert-buffers dir)
(dolist (b (adjoin status-buffer (dolist (b (adjoin status-buffer
magit-refresh-needing-buffers)) magit-refresh-needing-buffers))
(magit-refresh-buffer b))))))) (magit-refresh-buffer b)))))))