[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit e479739688: magit-insert-revision-message: Avoi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit e479739688: magit-insert-revision-message: Avoid hash section at message start |
Date: |
Sun, 20 Feb 2022 23:58:02 -0500 (EST) |
branch: elpa/git-commit
commit e479739688a501b1ff9a964484fd80a0c1b8ba52
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>
magit-insert-revision-message: Avoid hash section at message start
When magit-revision-use-hash-sections is non-nil,
magit-insert-revision-message searches the message for commits and
inserts (commit text) sections. It starts at the beginning of the
(commit-message) section, which means it's possible to add a
(commit text) section that starts at the same spot as
(commit-message).
Having two sections at the same point probably breaks various things,
but at the very least it prevents magit-section-backward from moving
beyond the shared (commit-message)/(commit text) start and can send
magit-section--backward-find into an infinite loop.
Prevent this by starting the search for commits one character after
the start of the (commit-message) section. This change means it's not
possible to convert the first word to a (commit text) section, but
it's doesn't seem worth doing anything more hacky or complicated to
support that.
Closes #4602.
---
lisp/magit-diff.el | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index e21c5e6717..96b32f708f 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2554,6 +2554,10 @@ or a ref which is not a branch, then it inserts nothing."
(fill-region (point) (line-end-position))))
(when magit-revision-use-hash-sections
(save-excursion
+ ;; Start after beg to prevent a (commit text) section from
+ ;; starting at the same point as the (commit-message)
+ ;; section.
+ (goto-char (1+ beg))
(while (not (eobp))
(re-search-forward "\\_<" nil 'move)
(let ((beg (point)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/git-commit e479739688: magit-insert-revision-message: Avoid hash section at message start,
ELPA Syncer <=