From: Kyle Meyer <kyle@kyleam.com>
To: piem@inbox.kyleam.com
Cc: zimoun <zimon.toutoune@gmail.com>
Subject: [PATCH 2/6] piem-am: Store "empty string" branch check
Date: Sun, 15 Nov 2020 01:15:14 -0500 [thread overview]
Message-ID: <20201115061518.22191-3-kyle@kyleam.com> (raw)
In-Reply-To: <20201115061518.22191-1-kyle@kyleam.com>
This will be needed in another spot.
---
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 @@ (defun piem-am (mbox &optional format info coderepo)
(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 @@ (defun piem-am (mbox &optional format info coderepo)
(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)
--
2.29.2
next prev parent reply other threads:[~2020-11-15 6:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-15 6:15 [PATCH 0/6] Support applying patches in a new worktree Kyle Meyer
2020-11-15 6:15 ` [PATCH 1/6] piem-am: Rephrase CODEREPO description Kyle Meyer
2020-11-15 6:15 ` Kyle Meyer [this message]
2020-11-15 6:15 ` [PATCH 3/6] am: Support creating a new worktree Kyle Meyer
2020-11-15 6:15 ` [PATCH 4/6] am: Add option to configure how worktree is read Kyle Meyer
2020-11-15 6:15 ` [PATCH 5/6] am: Allow flipping worktree creation with prefix argument Kyle Meyer
2020-11-15 6:15 ` [PATCH 6/6] manual: Document worktree-related options Kyle Meyer
2020-11-15 13:31 ` [PATCH 0/6] Support applying patches in a new worktree zimoun
2020-11-15 19:26 ` Kyle Meyer
2020-11-15 22:32 ` Kyle Meyer
2020-11-15 23:47 ` zimoun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://git.kyleam.com/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201115061518.22191-3-kyle@kyleam.com \
--to=kyle@kyleam.com \
--cc=piem@inbox.kyleam.com \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.kyleam.com/piem/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).