branch: elpa/magit
commit 9bd644a0e97c16e3564d278d0c0889fe1b6badf5
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-diff-wash-diff: Also stop when reaching a log heading
A diff may contain just headers and no hunk. When washing a diff
directly, we already detected that by checking whether we have reached
the beginning of the next diff or eob.
When the diff is part of a log, we additionally have to also check
whether we have reached the next log heading.
Alternatively we could pass along the limit from `magit-log-wash-rev'
(as a marker, because we modify the buffer text), but that would
complicate matters.
Closes #5454.
---
lisp/magit-diff.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index e229a92a62f..86da7965e23 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2458,7 +2458,9 @@ keymap is the parent of their keymaps."
(rename nil)
(binary nil))
(magit-delete-line)
- (while (not (or (eobp) (looking-at magit-diff-headline-re)))
+ (while (not (or (eobp)
+ (looking-at magit-diff-headline-re)
+ (looking-at magit-log-heading-re)))
(cond
((looking-at "old mode \\(?:[^\n]+\\)\nnew mode \\(?:[^\n]+\\)\n")
(setq modes (match-str 0)))