`magit-refresh-status' is used *very* often, so reduce function call
overhead by checking whether `magit-status-insert-tags-line' is non-nil
*before* running `magit-insert-status-tags-line'.

Signed-off-by: Pieter Praet <[email protected]>
---
 magit.el | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/magit.el b/magit.el
index 9a8f0ef..482863a 100644
--- a/magit.el
+++ b/magit.el
@@ -4312,20 +4312,19 @@ (defun magit-insert-status-line (heading info-string)
           info-string "\n"))
 
 (defun magit-insert-status-tags-line ()
-  (when magit-status-insert-tags-line
-    (let* ((current-tag (magit-get-current-tag t))
-           (next-tag (magit-get-next-tag t))
-           (both-tags (and current-tag next-tag t))
-           (tag-subject (eq magit-status-tags-line-subject 'tag)))
-      (when (or current-tag next-tag)
-        (magit-insert-status-line
-         (if both-tags "Tags" "Tag")
-         (concat
-          (and current-tag (apply 'magit-format-status-tag-sentence
-                                  tag-subject current-tag))
-          (and both-tags ", ")
-          (and next-tag (apply 'magit-format-status-tag-sentence
-                               (not tag-subject) next-tag))))))))
+  (let* ((current-tag (magit-get-current-tag t))
+         (next-tag (magit-get-next-tag t))
+         (both-tags (and current-tag next-tag t))
+         (tag-subject (eq magit-status-tags-line-subject 'tag)))
+    (when (or current-tag next-tag)
+      (magit-insert-status-line
+       (if both-tags "Tags" "Tag")
+       (concat
+        (and current-tag (apply 'magit-format-status-tag-sentence
+                                tag-subject current-tag))
+        (and both-tags ", ")
+        (and next-tag (apply 'magit-format-status-tag-sentence
+                             (not tag-subject) next-tag)))))))
 
 (defun magit-format-status-tag-sentence (behindp tag cnt &rest ignored)
   (concat (propertize tag 'face 'magit-tag)
@@ -4359,7 +4358,8 @@ (defun magit-refresh-status ()
                  " " (abbreviate-file-name default-directory)))
         (magit-insert-status-line
          "Head" (if no-commit "nothing committed (yet)" head))
-        (magit-insert-status-tags-line)
+        (when magit-status-insert-tags-line
+          (magit-insert-status-tags-line))
         (when merge-heads
           (magit-insert-status-line
            "Merging"
-- 
1.7.11.1

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to