From fa6bbfd2d65f3ec255e92bda30e8112dbe603bfc Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 7 Jan 2022 14:22:53 -0700 Subject: add `ask' value for mailscripts-detach-head-from-existing-branch Signed-off-by: Sean Whitton --- debian/changelog | 7 +++++++ mailscripts.el | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 947cbcb..69c65ae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +mailscripts (0.24-1) UNRELEASED; urgency=medium + + * mailscripts.el: + - mailscripts-detach-head-from-existing-branch can now have value `ask'. + + -- Sean Whitton Fri, 07 Jan 2022 14:21:25 -0700 + mailscripts (0.23-1) unstable; urgency=medium * New script: gmi2email diff --git a/mailscripts.el b/mailscripts.el index 8dc5875..ba4f9da 100644 --- a/mailscripts.el +++ b/mailscripts.el @@ -4,7 +4,7 @@ ;; Version: 0.23 ;; Package-Requires: (notmuch) -;; Copyright (C) 2018, 2019, 2020 Sean Whitton +;; Copyright (C) 2018, 2019, 2020, 2022 Sean Whitton ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -43,7 +43,9 @@ 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 + :type '(choice (const :tag "Always detach" t) + (const :tag "Never detach" nil) + (const :tag "Ask whether to detach" ask)) :group 'mailscripts) (defcustom mailscripts-project-library 'projectile @@ -193,7 +195,9 @@ git-format-patch(1)." (defun mailscripts--check-out-branch (branch) (if (string= branch "") - (when mailscripts-detach-head-from-existing-branch + (when (or (eq mailscripts-detach-head-from-existing-branch t) + (and (eq mailscripts-detach-head-from-existing-branch 'ask) + (yes-or-no-p "Detach HEAD before applying patches?"))) (call-process-shell-command "git checkout --detach")) (call-process-shell-command (format "git checkout -b %s" -- cgit v1.2.3