aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/magit-branch.el7
-rw-r--r--lisp/magit-git.el9
2 files changed, 10 insertions, 6 deletions
diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el
index 71d930d..7e252d3 100644
--- a/lisp/magit-branch.el
+++ b/lisp/magit-branch.el
@@ -827,12 +827,7 @@ and also rename the respective reflog file."
Rename \"refs/shelved/BRANCH\" to \"refs/heads/BRANCH\". If BRANCH
is prefixed with \"YYYY-MM-DD\", then drop that part of the name.
Also rename the respective reflog file."
- (interactive
- (list (magit-completing-read
- "Unshelve branch"
- (mapcar (##substring % 8)
- (nreverse (magit-list-refnames "refs/shelved")))
- nil t)))
+ (interactive (list (magit-read-shelved-branch "Unshelve branch")))
(let ((old (concat "refs/shelved/" branch))
(new (concat "refs/heads/"
(if (string-match-p
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 7e62da8..b1679c5 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -2851,6 +2851,15 @@ out. Only existing branches can be selected."
(string-match "^\\([^ ]+\\) \\(.+\\)" choice)
(substring-no-properties (match-str 1 choice)))))
+(defun magit-read-shelved-branch (prompt)
+ (magit-completing-read
+ prompt
+ (mapcar (##substring % 8)
+ (nreverse (magit-list-refnames "refs/shelved")))
+ nil t nil nil
+ (and$ (magit-section-value-if 'shelved-branch)
+ (substring $ 13))))
+
(defun magit-read-remote (prompt &optional default use-only)
(let ((remotes (magit-list-remotes)))
(if (and use-only (length= remotes 1))