summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-05-01 11:51:32 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-05-01 12:04:04 -0700
commit238b98bc4245783134b30cbb2918a95d19dacee6 (patch)
treea633aa51604e98bd0b41549b8ca53093f3596422
parentf343a4e23e11ae97e6354ca9c4f91a60a0ea6563 (diff)
downloadmailscripts-238b98bc4245783134b30cbb2918a95d19dacee6.tar.gz
mailscripts.el: Add mailscripts-detach-head-from-existing-branch
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--debian/changelog1
-rw-r--r--mailscripts.el15
2 files changed, 15 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index c530300..5624a7d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ mailscripts (0.20-1) UNRELEASED; urgency=medium
When the user inputs a branch name, it is used only to attempt the
creation of a new branch, but the old prompt suggests that inputting
an existing branch name would cause that branch to be checked out.
+ - Add mailscripts-detach-head-from-existing-branch defcustom.
* Add mailing list info to CONTRIBUTING.md.
-- Sean Whitton <spwhitton@spwhitton.name> Fri, 27 Mar 2020 11:50:27 -0700
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)
+
;;;###autoload
(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"))
(call-process-shell-command
(format "git checkout -b %s"
(shell-quote-argument