feat(magit): introduce +magit-auto-revert option

Provides more control over our auto-reverting feature, and changes its
behavior to only target non-remote buffers by default, because reverting
remote buffers could be tremendously slow.

This could be later improved to treat TRAMP buffers with local
methods (like sudo) as local buffers.

Fix: #8354
This commit is contained in:
Henrik Lissner
2025-04-10 18:02:10 -04:00
parent ae2cdd1c91
commit 0150f879ea
2 changed files with 34 additions and 1 deletions

View File

@@ -12,6 +12,28 @@ left and right fringe.
Only has an effect in GUI Emacs.")
(defvar +magit-auto-revert 'local
"If non-nil, revert associated buffers after Git operations with side-effects.
These buffers are auto-reverted immediately if they're visible or reverted next
time they're switched to. This is intended to be a much more efficient
replacement for `magit-auto-revert-mode' and `global-auto-revert-mode', and
should not be used together with them! Set this to `nil' if you plan to use the
above.
Accepts one of three values OR a predicate function:
t
Revert any associated buffers.
local
Same as `t', except remote (TRAMP) buffers are ignored.
nil
Don't do any auto-reverting at all.
FUNCTION
If given a function, it will be passed a buffer associated with the current
Magit session and must return non-nil to signal this is buffer is safe to
revert (now or later, when switched to).")
;;
;;; Packages