summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-11-15 01:15:14 -0500
committerKyle Meyer <kyle@kyleam.com>2020-11-15 17:11:37 -0500
commit291878e359aa05bffe8ad971e309e31197d573a5 (patch)
tree0a6e0978b15a5ac6f18c216049b4728a1a9c1309
parent613b6255abcb2feba8a99f847f17b16f5af50e48 (diff)
downloadpiem-291878e359aa05bffe8ad971e309e31197d573a5.tar.gz
piem-am: Store "empty string" branch check
This will be needed in another spot. Message-Id: <20201115061518.22191-3-kyle@kyleam.com>
-rw-r--r--piem.el11
1 files 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)