[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 44c58868c9 3/3: Combine neighboring chunks abou
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 44c58868c9 3/3: Combine neighboring chunks about the same commit |
Date: |
Fri, 25 Feb 2022 04:58:13 -0500 (EST) |
branch: elpa/git-commit
commit 44c58868c997f0b86d66faeed2f0b29064f8d0b9
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Combine neighboring chunks about the same commit
When using, e.g., "--ignore-revs" together with "--incremental", it
can happen that neighboring chunks are actually about the same commit.
This only looks backward because that is all that was needed in the
test cases I used. It is possible that we will have to extend this
to also look the other way.
Closes #4030.
---
lisp/magit-blame.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el
index 93d37e854d..b12e0099d5 100644
--- a/lisp/magit-blame.el
+++ b/lisp/magit-blame.el
@@ -546,7 +546,15 @@ modes is toggled, then this mode also gets toggled
automatically.
(let* ((line (oref chunk final-line))
(beg (magit-blame--line-beginning-position line))
(end (magit-blame--line-beginning-position
- (+ line (oref chunk num-lines)))))
+ (+ line (oref chunk num-lines))))
+ (before (magit-blame-chunk-at (1- beg))))
+ (when (and before
+ (equal (oref before orig-rev)
+ (oref chunk orig-rev)))
+ (setq beg (magit-blame--line-beginning-position
+ (oset chunk final-line (oref before final-line))))
+ (cl-incf (oref chunk num-lines)
+ (oref before num-lines)))
(magit-blame--remove-overlays beg end)
(when magit-blame--make-margin-overlays
(magit-blame--make-margin-overlays chunk revinfo beg end))