emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit 09333d6 3/8: magit-save-repository-buffers: Rea


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 09333d6 3/8: magit-save-repository-buffers: Rearrange and improve comments
Date: Tue, 12 Oct 2021 14:57:47 -0400 (EDT)

branch: elpa/git-commit
commit 09333d63a28d476cb036edd588013ac37b2484ac
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-save-repository-buffers: Rearrange and improve comments
---
 lisp/magit-mode.el | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index 9a4585c..59b8fd0 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -1220,15 +1220,19 @@ argument (the prefix) non-nil means save all with no 
questions."
              ,@save-some-buffers-action-alist)))
       (save-some-buffers
        arg (lambda ()
-             (and (not magit-inhibit-refresh-save)
-                  buffer-file-name
-                  ;; Avoid needlessly connecting to unrelated remotes.
+             (and buffer-file-name
+                  ;; - Check whether refreshing is disabled.
+                  (not magit-inhibit-refresh-save)
+                  ;; - Check whether the visited file is either on the
+                  ;;   same remote as the repository, or both are on
+                  ;;   the local system.
                   (equal (file-remote-p buffer-file-name) remote)
-                  ;; For remote files this makes network requests and
-                  ;; therefore has to come after the above to avoid
-                  ;; unnecessarily waiting for unrelated hosts.
-                  (file-writable-p buffer-file-name)
-                  (equal (magit-rev-parse-safe "--show-toplevel") topdir)))))))
+                  ;; Delayed checks that are more expensive for remote
+                  ;; repositories, due to the required network access.
+                  ;; - Check whether the file is inside the repository.
+                  (equal (magit-rev-parse-safe "--show-toplevel") topdir)
+                  ;; - Check whether the file is actually writable.
+                  (file-writable-p buffer-file-name)))))))
 
 ;;; Restore Window Configuration
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]