summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin <alban.gruin@gmail.com>2020-01-21 19:32:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-26 16:39:21 (GMT)
commit240fc04f81fcc6c646ec08bfab4662bb09e44c50 (patch)
tree8bbed0059549df94c58af843ccdce60e0bdd9187
parentc522f061d551c9bb8684a7c3859b2ece4499b56b (diff)
downloadgit-240fc04f81fcc6c646ec08bfab4662bb09e44c50.zip
git-240fc04f81fcc6c646ec08bfab4662bb09e44c50.tar.gz
git-240fc04f81fcc6c646ec08bfab4662bb09e44c50.tar.bz2
builtin/rebase: remove a call to get_oid() on `options.switch_to'
When `options.switch_to' is set, `options.orig_head' is populated right after with the object name the ref/commit argument points at. Therefore, there is no need to parse `switch_to' again. Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/rebase.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 8081741..d225c7f 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -2064,19 +2064,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) {