[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 8606488578 2/7: magit-save-repository-buffers:
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 8606488578 2/7: magit-save-repository-buffers: Rev-parse only once per directory |
Date: |
Fri, 17 Mar 2023 19:59:47 -0400 (EDT) |
branch: elpa/git-commit
commit 860648857875ca904c4b7b4678f7b8692296bb24
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-save-repository-buffers: Rev-parse only once per directory
Previously we called "git rev-parse --show-toplevel" once per buffer,
but since the `default-directory' is the same for many of them, that
needlessly repeated expensive work.
---
lisp/magit-mode.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index 2b69744069..c6ec10914c 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -1116,7 +1116,8 @@ argument (the prefix) non-nil means save all with no
questions."
(with-current-buffer buffer
(setq magit-inhibit-refresh-save t)))
"to skip the current buffer and remember choice")
- ,@save-some-buffers-action-alist)))
+ ,@save-some-buffers-action-alist))
+ (dirs nil))
(save-some-buffers
arg
(lambda ()
@@ -1140,7 +1141,11 @@ argument (the prefix) non-nil means save all with no
questions."
;; repositories, due to the required network access.
;;
;; Check whether the file is inside the repository.
- (equal (magit-rev-parse-safe "--show-toplevel") topdir)
+ (equal (or (cdr (assoc default-directory dirs))
+ (let ((dir (magit-rev-parse-safe "--show-toplevel")))
+ (push (cons default-directory dir) dirs)
+ dir))
+ topdir)
;; Check whether the file is actually writable.
(file-writable-p buffer-file-name))))))))
- [nongnu] elpa/git-commit updated (eb66aed3b4 -> 564a5ceeb0), ELPA Syncer, 2023/03/17
- [nongnu] elpa/git-commit e23846ec2d 1/7: magit-save-repository-buffers: Cosmetics, ELPA Syncer, 2023/03/17
- [nongnu] elpa/git-commit 8606488578 2/7: magit-save-repository-buffers: Rev-parse only once per directory,
ELPA Syncer <=
- [nongnu] elpa/git-commit e94b6ebfdb 6/7: Record diff-type in magit-diff-mode buffers, ELPA Syncer, 2023/03/17
- [nongnu] elpa/git-commit 564a5ceeb0 7/7: magit-git-debug: Fix key binding in docstring, ELPA Syncer, 2023/03/17
- [nongnu] elpa/git-commit c5c8f79167 4/7: magit-toplevel: Cosmetics, ELPA Syncer, 2023/03/17
- [nongnu] elpa/git-commit ff4710afa6 3/7: Deprecate magit-git-dir to avoid needlessly repeating work, ELPA Syncer, 2023/03/17
- [nongnu] elpa/git-commit 623d335b4d 5/7: Memorize gitdir and topdir for each Magit buffer, ELPA Syncer, 2023/03/17