From 291878e359aa05bffe8ad971e309e31197d573a5 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 15 Nov 2020 01:15:14 -0500 Subject: piem-am: Store "empty string" branch check This will be needed in another spot. Message-Id: <20201115061518.22191-3-kyle@kyleam.com> --- piem.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/piem.el b/piem.el index 8ee5b0b..a42ab3d 100644 --- a/piem.el +++ b/piem.el @@ -669,9 +669,10 @@ within. If not specified, the default directory is used." (interactivep (eq (car-safe mbox) :interactive))) (when interactivep (setq mbox (cdr mbox))) - (let ((new-branch (read-string - "New branch (empty for detached): " - (funcall piem-default-branch-function info))) + (let ((new-branch + (let ((b (read-string "New branch (empty for detached): " + (funcall piem-default-branch-function info)))) + (and (not (string-empty-p b)) b))) (base (completing-read "Base commit: " (let ((cands (and piem-use-magit @@ -680,9 +681,7 @@ within. If not specified, the default directory is used." (base (plist-get info :base-commit))) (if base (cons base cands) cands))))) (apply #'piem-process-call nil piem-git-executable "checkout" - (append (if (string-empty-p new-branch) - (list "--detach") - (list "-b" new-branch)) + (append (if new-branch (list "-b" new-branch) (list "--detach")) (and (not (string-blank-p base)) (list base))))) (let ((args (cons (concat "--patch-format=" format) -- cgit v1.2.3