stacked-git / magit-stgit

StGit extension for Magit
7 stars 7 forks source link

magit 2.90 support #16

Closed cpg314 closed 8 months ago

cpg314 commented 8 months ago

The magit-section-when function has been deprecated in magit 2.90: https://github.com/magit/magit/blob/c7ab6931c61e63db02edd2f9ad3688312936cf0b/docs/RelNotes/2.90.0.org#breaking-changes and was removed in March.

The following patch should allow magit-stgit to function with old and new versions of magit:

diff --git a/magit-stgit.el b/magit-stgit.el
index ef194c8..5e2c806 100644
--- a/magit-stgit.el
+++ b/magit-stgit.el
@@ -200,7 +200,12 @@ PROMPT."
         region
         (and use-marks
              (magit-stgit-patches-sorted magit-stgit-marked-patches))
-        (list (or (and use-point (magit-section-when stgit-patch))
+        (list (or (and use-point
+                       (if (fboundp 'magit-section-value-if)
+                           (magit-section-value-if 'stgit-patch)
+                         (magit-section-when stgit-patch)
+                         )
+                       )
                   (and prompt (magit-stgit-read-patch prompt require-match)))))))

 ;;; Marking
jpgrayson commented 8 months ago

Thanks for the patch @cpg314.