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

    magit-rebase--get-state-lines: New function
---
 lisp/Makefile          |  2 +-
 lisp/magit-sequence.el |  9 +++++++++
 lisp/magit-stash.el    | 10 ++--------
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/lisp/Makefile b/lisp/Makefile
index 3937afc1de..b0ef31fcc9 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -53,7 +53,7 @@ magit-fetch.elc:        magit.elc
 magit-pull.elc:         magit.elc magit-remote.elc
 magit-push.elc:         magit.elc
 magit-bisect.elc:       magit.elc
-magit-stash.elc:        magit.elc magit-reflog.elc
+magit-stash.elc:        magit.elc magit-sequence.elc magit-reflog.elc
 magit-blame.elc:        magit.elc
 magit-obsolete.elc:     magit.elc
 magit-submodule.elc:    magit.elc
diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el
index ab6c4b1741..bfc46ebb8b 100644
--- a/lisp/magit-sequence.el
+++ b/lisp/magit-sequence.el
@@ -856,6 +856,15 @@ edit.  With a prefix argument the old message is reused 
as-is."
 (defun magit--rebase-resume-command ()
   (if (file-exists-p (magit-git-dir "rebase-recursive")) "rbr" "rebase"))
 
+(defun magit-rebase--get-state-lines (file)
+  (and (magit-rebase-in-progress-p)
+       (magit-file-line
+        (magit-git-dir
+         (concat (if (file-directory-p (magit-git-dir "rebase-merge"))
+                     "rebase-merge/"
+                   "rebase-apply/")
+                 file)))))
+
 ;;; Sections
 
 (defun magit-insert-sequencer-sequence ()
diff --git a/lisp/magit-stash.el b/lisp/magit-stash.el
index 2b80fc8796..ecaf38797a 100644
--- a/lisp/magit-stash.el
+++ b/lisp/magit-stash.el
@@ -31,6 +31,7 @@
 
 (require 'magit)
 (require 'magit-reflog)
+(require 'magit-sequence)
 
 ;;; Options
 
@@ -374,14 +375,7 @@ If optional REF is non-nil, show reflog for that instead.
 If optional HEADING is non-nil, use that as section heading
 instead of \"Stashes:\"."
   (let ((verified (magit-rev-verify ref))
-        (autostash
-         (and (magit-rebase-in-progress-p)
-              (thread-first
-                  (if (file-directory-p (magit-git-dir "rebase-merge"))
-                      "rebase-merge/autostash"
-                    "rebase-apply/autostash")
-                magit-git-dir
-                magit-file-line))))
+        (autostash (magit-rebase--get-state-lines "autostash")))
     (when (or autostash verified)
       (magit-insert-section (stashes ref)
         (magit-insert-heading heading)

Reply via email to