[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/magit b2a4da4df2 4/5: magit-insert-recent-commits: Only us
From: |
Jonas Bernoulli |
Subject: |
[nongnu] elpa/magit b2a4da4df2 4/5: magit-insert-recent-commits: Only use explicit range with --graph |
Date: |
Fri, 30 Aug 2024 17:00:09 -0400 (EDT) |
branch: elpa/magit
commit b2a4da4df27048c271cb341a6b4b60658d0469a1
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-insert-recent-commits: Only use explicit range with --graph
Since [1: 55a61d15e8] we use an explicit range "HEAD~<N>..HEAD" in
addition to "-n<N>", for a massive speedup when using "--graph".
When not using "--graph", then that actually results in a (smaller)
slowdown, so stop doing it in that case.
When `core.commitGraph' is enabled (the default) and an up-to-date
commit-graph file exists (it usually does not), then we could always
omit the range, but it wouldn't make much of a difference in that case.
core.commitGraph=false -n10 0.557
core.commitGraph=false HEAD~10..HEAD 1.613
core.commitGraph=false -n10 HEAD~10..HEAD 1.569
core.commitGraph=false --graph -n10 63.776
core.commitGraph=false --graph HEAD~10..HEAD 1.555
core.commitGraph=false --graph -n10 HEAD~10..HEAD 1.500
core.commitGraph=true -n10 0.545
core.commitGraph=true HEAD~10..HEAD 0.688
core.commitGraph=true -n10 HEAD~10..HEAD 0.630
core.commitGraph=true --graph -n10 0.542
core.commitGraph=true --graph HEAD~10..HEAD 0.598
core.commitGraph=true --graph -n10 HEAD~10..HEAD 0.491
Also see #5075.
1: 2015-09-07 55a61d15e85fe46409e512cc60815e61b4843066
avoid `git log --graph' inefficiency
---
lisp/magit-log.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index f2a70ca24a..6c304d00b6 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -1955,7 +1955,8 @@ Show the last `magit-log-section-commit-count' commits."
(or value range)
t)
(magit-insert-heading "Recent commits")
- (magit--insert-log nil range
+ (magit--insert-log nil
+ (and (member "--graph" magit-buffer-log-args) range)
(cons (format "-n%d" magit-log-section-commit-count)
(--remove (string-prefix-p "-n" it)
magit-buffer-log-args))))))