path: root/mailscripts.el
diff options
Diffstat (limited to 'mailscripts.el')
1 files changed, 14 insertions, 1 deletions
diff --git a/mailscripts.el b/mailscripts.el
index 904a30a..6fc8c69 100644
--- a/mailscripts.el
+++ b/mailscripts.el
@@ -34,6 +34,17 @@ E.g. `email/'."
:type 'string
:group 'mailscripts)
+(defcustom mailscripts-detach-head-from-existing-branch nil
+ "Whether to detach HEAD before applying patches to an existing branch.
+This is useful if you want to manually review the result of
+applying patches before updating any of your existing branches,
+or for quick, ad hoc testing of a patch series.
+Note that this does not prevent the creation of new branches."
+ :type 'boolean
+ :group 'mailscripts)
(defun notmuch-slurp-debbug (bug &optional no-open)
"Slurp Debian bug with bug number BUG and open the thread in notmuch.
@@ -131,7 +142,9 @@ git-format-patch(1)."
(mailscripts--projectile-repo-and-branch 'notmuch-extract-message-patches))
(defun mailscripts--check-out-branch (branch)
- (unless (string= branch "")
+ (if (string= branch "")
+ (when mailscripts-detach-head-from-existing-branch
+ (call-process-shell-command "git checkout --detach"))
(format "git checkout -b %s"