branch: elpa/git-commit
commit 5544bac955670240d3862e60d36d787f5856e3a3
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-insert-section--finish: Avoid unnecessary work for root section
    
    No longer loop over all text (again) on behalf of the root section.
    It is unnecessary to do that because all text should already have been
    propertized when looping over it on behalf on the child sections.
    
    It is *possible* that there still exist root sections that do have a
    heading and/or text after the last child, in which case we would now
    fail to propertize that.
    
    However, if that is the case, then that is something that should be
    improved, regardless of this optimization.  The heading should be
    replaced with information displayed header-line, and the trailing
    text should in all likelihood just be removed.
    
    In any case, do not perform unnecessary work in every buffer, just in
    case some obscure buffer still benefits from that work.
---
 lisp/magit-section.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 1e7f1970b8..8d36c2374c 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1450,7 +1450,8 @@ anything this time around.
         (children (oref obj children)))
     (unless magit-section-inhibit-markers
       (set-marker-insertion-type beg t))
-    (cond (children
+    (cond ((eq obj magit-root-section))
+          (children
            (magit-insert-child-count obj)
            (save-excursion
              (goto-char beg)

Reply via email to