Prevent magit trying to revert non-existent file buffers
This commit is contained in:
parent
9d56af728f
commit
0a9b06ac16
1 changed files with 10 additions and 6 deletions
|
@ -48,12 +48,16 @@
|
|||
(defun +magit--revert-buffer (buffer)
|
||||
(with-current-buffer buffer
|
||||
(kill-local-variable '+magit--stale-p)
|
||||
(if (buffer-file-name (buffer-base-buffer))
|
||||
(and (or (not (buffer-modified-p))
|
||||
(y-or-n-p "Version control data is outdated in this buffer, but it is unsaved. Revert anyway?"))
|
||||
(revert-buffer t t))
|
||||
(when (and vc-mode (fboundp 'vc-refresh-state))
|
||||
(vc-refresh-state)))))
|
||||
(let ((buffer (or (buffer-base-buffer) (current-buffer))))
|
||||
(if-let (file (buffer-file-name buffer))
|
||||
(and (file-exists-p file)
|
||||
(or (not (buffer-modified-p buffer))
|
||||
(y-or-n-p
|
||||
(format "Version control data is outdated in %s, but it is unsaved. Revert anyway?"
|
||||
buffer)))
|
||||
(revert-buffer t t))
|
||||
(when (and vc-mode (fboundp 'vc-refresh-state))
|
||||
(vc-refresh-state))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +magit-mark-stale-buffers-h ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue