summaryrefslogtreecommitdiff
path: root/mailscripts.el
diff options
context:
space:
mode:
Diffstat (limited to 'mailscripts.el')
-rw-r--r--mailscripts.el23
1 files changed, 14 insertions, 9 deletions
diff --git a/mailscripts.el b/mailscripts.el
index 6bc64bc..db1cf94 100644
--- a/mailscripts.el
+++ b/mailscripts.el
@@ -65,7 +65,8 @@ The target branch may or may not already exist.
See notmuch-extract-patch(1) manpage for limitations: in
particular, this Emacs Lisp function supports passing only entire
threads to the notmuch-extract-patch(1) command."
- (interactive "Dgit repo: \nsnew branch name: \nP")
+ (interactive
+ "Dgit repo: \nsbranch name (or leave blank to apply to current HEAD): \nP")
(let ((thread-id notmuch-show-thread-id)
(default-directory (expand-file-name repo)))
(mailscripts--check-out-branch branch no-prefix)
@@ -93,7 +94,8 @@ The target branch may or may not already exist.
Patches are applied using git-am(1), so we only consider
attachments with filenames which look like they were generated by
git-format-patch(1)."
- (interactive "Dgit repo: \nsnew branch name: \nP")
+ (interactive
+ "Dgit repo: \nsbranch name (or leave blank to apply to current HEAD): \nP")
(with-current-notmuch-show-message
(let ((default-directory (expand-file-name repo))
(mm-handle (mm-dissect-buffer)))
@@ -116,17 +118,20 @@ git-format-patch(1)."
'notmuch-extract-message-patches no-prefix))
(defun mailscripts--check-out-branch (branch no-prefix)
- (call-process-shell-command
- (format "git checkout -b %s"
- (shell-quote-argument
- (if (and (not no-prefix) mailscripts-extract-patches-branch-prefix)
- (concat mailscripts-extract-patches-branch-prefix branch)
- branch)))))
+ (unless (string= branch "")
+ (call-process-shell-command
+ (format "git checkout -b %s"
+ (shell-quote-argument
+ (if (and (not no-prefix) mailscripts-extract-patches-branch-prefix)
+ (concat mailscripts-extract-patches-branch-prefix branch)
+ branch))))))
(defun mailscripts--projectile-repo-and-branch (f &optional no-prefix)
(let ((repo (projectile-completing-read
"Select projectile project: " projectile-known-projects))
- (branch (completing-read "Branch name: " nil)))
+ (branch (completing-read
+ "Branch name (or leave blank to apply to current HEAD): "
+ nil)))
(funcall f repo branch no-prefix)))
(provide 'mailscripts)