aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-11-15 01:15:16 -0500
committerKyle Meyer <kyle@kyleam.com>2020-11-15 17:12:25 -0500
commit251f9a264b3d0b5a4f4a976bf18b505c769b7e04 (patch)
tree73f6081df9f16defc08a43e62ce2d09cfca95a6f
parent060055dcf7817aa75462994a5e2051e2ae8daefa (diff)
downloadpiem-251f9a264b3d0b5a4f4a976bf18b505c769b7e04.tar.gz
am: Add option to configure how worktree is read
It seems likely that piem-am-read-worktree won't quite behave as some callers want. Let users specify a custom function. Message-Id: <20201115061518.22191-5-kyle@kyleam.com>
-rw-r--r--piem.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/piem.el b/piem.el
index dbcd4d5..81c5196 100644
--- a/piem.el
+++ b/piem.el
@@ -158,6 +158,14 @@ the following information about the patch series:
"Whether to create a dedicated worktree for applying patches."
:type 'boolean)
+(defcustom piem-am-read-worktree-function #'piem-am-read-worktree
+ "Function that reads a to-be-created worktree from the user.
+This function is called with two arguments, the directory of the
+code repository that the worktree will be created from and the
+name of the branch that will be created. The branch may be nil
+if the caller requested a detached HEAD."
+ :type 'function)
+
(defcustom piem-maildir-directory nil
"Inject public-inbox threads into this directory.
If non-nil, this must be an existing Maildir directory."
@@ -702,7 +710,8 @@ within. If not specified, the default directory is used."
(when piem-am-create-worktree
(setq am-directory
(expand-file-name
- (piem-am-read-worktree default-directory new-branch)))
+ (funcall piem-am-read-worktree-function
+ default-directory new-branch)))
(when (file-exists-p am-directory)
(user-error "Worktree directory already exists")))
(apply #'piem-process-call nil piem-git-executable