Revert buffers after committing
I find the VC status on the modeline useful (the one that shows Git[:-]branchname) This indicates when the buffer's associated file was changed on disk (`:' for edited, `-' for unedited.) This indicator is not affected by a commit with magit, so it keeps signaling a file as edited when in fact it is not. This patch reverts all buffers that are visiting a file in the current working tree after a commit.
This commit is contained in:
parent
5f371df069
commit
51a1b6d84c
1 changed files with 3 additions and 2 deletions
5
magit.el
5
magit.el
|
@ -1719,12 +1719,12 @@ Please see the manual for a complete description of Magit.
|
|||
(defun magit-string-has-prefix-p (string prefix)
|
||||
(eq (compare-strings string nil (length prefix) prefix nil nil) t))
|
||||
|
||||
(defun magit-revert-buffers (dir)
|
||||
(defun magit-revert-buffers (dir &optional ignore-modtime)
|
||||
(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))
|
||||
(or ignore-modtime (not (verify-visited-file-modtime buffer)))
|
||||
(not (buffer-modified-p buffer)))
|
||||
(with-current-buffer buffer
|
||||
(ignore-errors
|
||||
|
@ -3082,6 +3082,7 @@ Prefix arg means justify as well."
|
|||
(bury-buffer)
|
||||
(when (file-exists-p ".git/MERGE_MSG")
|
||||
(delete-file ".git/MERGE_MSG"))
|
||||
(magit-revert-buffers default-directory t)
|
||||
(when magit-pre-log-edit-window-configuration
|
||||
(set-window-configuration magit-pre-log-edit-window-configuration)
|
||||
(setq magit-pre-log-edit-window-configuration nil))))
|
||||
|
|
Loading…
Reference in a new issue