Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only revert buffers that belong to the current repo.

  • Loading branch information...
commit 31b8be948aeb7b6d12f12f38da1815f659ab637a 1 parent 3731a18
@mvollmer mvollmer authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 magit.el
View
16 magit.el
@@ -1332,9 +1332,14 @@ Please see the manual for a complete description of Magit.
(set-window-point w (point)))
(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))
(when (and buffer
+ (buffer-file-name buffer)
+ (magit-string-has-prefix-p (buffer-file-name buffer) dir)
(not (verify-visited-file-modtime buffer))
(not (buffer-modified-p buffer)))
(with-current-buffer buffer
@@ -1347,13 +1352,14 @@ Please see the manual for a complete description of Magit.
(defun magit-refresh-wrapper (func)
(if magit-refresh-pending
(funcall func)
- (let ((status-buffer (magit-find-buffer 'status default-directory))
- (magit-refresh-needing-buffers nil)
- (magit-refresh-pending t))
+ (let* ((dir default-directory)
+ (status-buffer (magit-find-buffer 'status dir))
+ (magit-refresh-needing-buffers nil)
+ (magit-refresh-pending t))
(unwind-protect
(funcall func)
(when magit-refresh-needing-buffers
- (magit-revert-buffers)
+ (magit-revert-buffers dir)
(dolist (b (adjoin status-buffer
magit-refresh-needing-buffers))
(magit-refresh-buffer b)))))))
Please sign in to comment.
Something went wrong with that request. Please try again.