A better way for updating the VC modeline
Revision 51a1b6d8
introduced a change that reverts all buffers after a
commit operation for refreshing the VC modeline info. This can be slow
(because refontification, etc) and have side effects (changes on display
settings for some modes.) Instead of reverting the buffer, we now call
`vc-find-file-hook' which is much faster and have no side effects. We
now update the VC modeline info after resetting, because that operation
may change the VC status without changing the file contents (commit a
change and then reset to HEAD^, for instance.)
This commit is contained in:
parent
9c1a508827
commit
51fffcb3a9
1 changed files with 14 additions and 4 deletions
16
magit.el
16
magit.el
|
@ -1805,6 +1805,15 @@ Please see the manual for a complete description of Magit.
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(revert-buffer t t nil))))))
|
(revert-buffer t t nil))))))
|
||||||
|
|
||||||
|
(defun magit-update-vc-modeline (dir)
|
||||||
|
(dolist (buffer (buffer-list))
|
||||||
|
(when (and buffer
|
||||||
|
(buffer-file-name buffer)
|
||||||
|
(magit-string-has-prefix-p (buffer-file-name buffer) dir))
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(ignore-errors
|
||||||
|
(vc-find-file-hook))))))
|
||||||
|
|
||||||
(defvar magit-refresh-needing-buffers nil)
|
(defvar magit-refresh-needing-buffers nil)
|
||||||
(defvar magit-refresh-pending nil)
|
(defvar magit-refresh-pending nil)
|
||||||
|
|
||||||
|
@ -2833,9 +2842,10 @@ and staging area are lost.
|
||||||
(or (magit-default-rev)
|
(or (magit-default-rev)
|
||||||
"HEAD^"))
|
"HEAD^"))
|
||||||
current-prefix-arg))
|
current-prefix-arg))
|
||||||
(if revision
|
(when revision
|
||||||
(magit-run-git "reset" (if hard "--hard" "--soft")
|
(magit-run-git "reset" (if hard "--hard" "--soft")
|
||||||
(magit-rev-to-git revision))))
|
(magit-rev-to-git revision))
|
||||||
|
(magit-update-vc-modeline default-directory)))
|
||||||
|
|
||||||
(defun magit-reset-head-hard (revision)
|
(defun magit-reset-head-hard (revision)
|
||||||
"Switch 'HEAD' to REVISION, losing all changes.
|
"Switch 'HEAD' to REVISION, losing all changes.
|
||||||
|
@ -3210,7 +3220,7 @@ Prefix arg means justify as well."
|
||||||
(bury-buffer)
|
(bury-buffer)
|
||||||
(when (file-exists-p ".git/MERGE_MSG")
|
(when (file-exists-p ".git/MERGE_MSG")
|
||||||
(delete-file ".git/MERGE_MSG"))
|
(delete-file ".git/MERGE_MSG"))
|
||||||
(magit-revert-buffers default-directory t)
|
(magit-update-vc-modeline default-directory)
|
||||||
(when magit-pre-log-edit-window-configuration
|
(when magit-pre-log-edit-window-configuration
|
||||||
(set-window-configuration magit-pre-log-edit-window-configuration)
|
(set-window-configuration magit-pre-log-edit-window-configuration)
|
||||||
(setq magit-pre-log-edit-window-configuration nil))))
|
(setq magit-pre-log-edit-window-configuration nil))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue