Skip to content

Commit 240fc04

Browse files
agrngitster
authored andcommitted
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 <[email protected]> Acked-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c522f06 commit 240fc04

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

builtin/rebase.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,19 +2064,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
20642064
if (!(options.flags & REBASE_FORCE)) {
20652065
/* Lazily switch to the target branch if needed... */
20662066
if (options.switch_to) {
2067-
struct object_id oid;
2068-
2069-
if (get_oid(options.switch_to, &oid) < 0) {
2070-
ret = !!error(_("could not parse '%s'"),
2071-
options.switch_to);
2072-
goto cleanup;
2073-
}
2074-
20752067
strbuf_reset(&buf);
20762068
strbuf_addf(&buf, "%s: checkout %s",
20772069
getenv(GIT_REFLOG_ACTION_ENVIRONMENT),
20782070
options.switch_to);
2079-
if (reset_head(&oid, "checkout",
2071+
if (reset_head(&options.orig_head, "checkout",
20802072
options.head_name,
20812073
RESET_HEAD_RUN_POST_CHECKOUT_HOOK,
20822074
NULL, buf.buf) < 0) {

0 commit comments

Comments
 (0)