branch: elpa/magit
commit d6b77845470f67b23a8b2776bad5c0ece0a30000
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-insert-shelved-branches: New function
---
 lisp/magit-refs.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el
index be8a961368..af50205f27 100644
--- a/lisp/magit-refs.el
+++ b/lisp/magit-refs.el
@@ -639,6 +639,21 @@ line is inserted at all."
     (insert ?\n)
     (magit-make-margin-overlay nil t)))
 
+(defun magit-insert-shelved-branches ()
+  "Insert sections showing all shelved branches."
+  (when-let ((refs (magit-list-refs "refs/shelved/")))
+    (magit-insert-section (shelved-branches nil)
+      (magit-insert-heading t "Shelved branches")
+      (dolist (ref refs)
+        (magit-insert-section (shelved-branch ref t)
+          (magit-insert-heading
+            (magit--propertize-face (substring ref 13) 'magit-refname))
+          (when (magit-buffer-margin-p)
+            (magit-refs--format-margin ref))
+          (magit-refs--insert-cherry-commits ref)))
+      (insert ?\n)
+      (magit-make-margin-overlay nil t))))
+
 (defun magit-refs--format-local-branches ()
   (let ((lines (seq-keep #'magit-refs--format-local-branch
                          (magit-git-lines

Reply via email to