From: Alban Gruin <alban.gruin@gmail.com>
To: git@vger.kernel.org, phillip.wood@dunelm.org.uk,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Junio C Hamano <gitster@pobox.com>
Cc: Alban Gruin <alban.gruin@gmail.com>
Subject: [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to'
Date: Tue, 21 Jan 2020 20:32:26 +0100 [thread overview]
Message-ID: <20200121193226.24297-1-alban.gruin@gmail.com> (raw)
When `options.switch_to' is set, `options.orig_head' is populated right
after. Therefore, there is no need to parse `switch_to' again.
Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
---
builtin/rebase.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 6154ad8fa5..16d2ec7ebc 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -2056,19 +2056,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (!(options.flags & REBASE_FORCE)) {
/* Lazily switch to the target branch if needed... */
if (options.switch_to) {
- struct object_id oid;
-
- if (get_oid(options.switch_to, &oid) < 0) {
- ret = !!error(_("could not parse '%s'"),
- options.switch_to);
- goto cleanup;
- }
-
strbuf_reset(&buf);
strbuf_addf(&buf, "%s: checkout %s",
getenv(GIT_REFLOG_ACTION_ENVIRONMENT),
options.switch_to);
- if (reset_head(&oid, "checkout",
+ if (reset_head(&options.orig_head, "checkout",
options.head_name,
RESET_HEAD_RUN_POST_CHECKOUT_HOOK,
NULL, buf.buf) < 0) {
--
2.24.1
next reply other threads:[~2020-01-21 19:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-21 19:32 Alban Gruin [this message]
2020-01-22 14:00 ` [PATCH v1] builtin/rebase: remove a call to get_oid() on `options.switch_to' Johannes Schindelin
2020-01-22 20:47 ` Junio C Hamano
2020-02-14 20:43 ` Alban Gruin
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200121193226.24297-1-alban.gruin@gmail.com \
--to=alban.gruin@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
/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.
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 NNTP newsgroup(s).