Allows us to back out of a `magit-cherry' invocation without having to
do manual cleanup.  Ideal when the summer heat interferes with your fine
motor skills.

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

diff --git a/magit-cherry.el b/magit-cherry.el
index bfc8bf4..04e193d 100644
--- a/magit-cherry.el
+++ b/magit-cherry.el
@@ -36,18 +36,20 @@ (define-derived-mode magit-cherry-mode magit-mode "Magit 
Cherry"
 
 (magit-define-command cherry (&optional upstream head)
   (interactive)
-  (let ((branch (magit-get-current-branch)))
-    (if (not branch)
-        (error "Don't cherry on a detached head.")
-      (magit-buffer-switch magit--cherry-buffer-name)
-      (magit-mode-init
-       (magit-get-top-dir)
-       'magit-cherry-mode
-       #'magit--refresh-cherry-buffer
-       (or upstream (magit-read-rev "Upstream"
-                                    (magit-format-ref
-                                     (magit-remote-branch-for branch t))))
-       (or head (magit-read-rev "Head" branch))))))
+  (let* ((branch (or (magit-get-current-branch)
+                     (error "Don't cherry on a detached head.")))
+         (upstream (or upstream
+                       (magit-read-rev "Cherry upstream"
+                                       (magit-format-ref
+                                        (magit-remote-branch-for branch t)))))
+         (head (or head
+                   (magit-read-rev "Cherry head" branch))))
+    (magit-buffer-switch magit--cherry-buffer-name)
+    (magit-mode-init (magit-get-top-dir)
+                     'magit-cherry-mode
+                     #'magit--refresh-cherry-buffer
+                     upstream
+                     head)))
 
 (defun magit--refresh-cherry-buffer (cherry-upstream cherry-head)
   (magit-create-buffer-sections
-- 
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