From: Oswald Buddenhagen Date: Fri, 20 Oct 2023 09:36:52 +0000 (+0200) Subject: rebase: simplify code related to imply_merge() X-Git-Tag: v2.43.0-rc0~6^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5b5740bf63cd435fb172b12aa97176f13ff3fd3;p=thirdparty%2Fgit.git rebase: simplify code related to imply_merge() The code's evolution left in some bits surrounding enum rebase_type that don't really make sense any more. In particular, it makes no sense to invoke imply_merge() if the type is already known not to be REBASE_APPLY, and it makes no sense to assign the type after calling imply_merge(). enum rebase_type had more values until commit a74b35081c ("rebase: drop support for `--preserve-merges`") and commit 10cdb9f38a ("rebase: rename the two primary rebase backends"). The latter commit also renamed imply_interactive() to imply_merge(). Signed-off-by: Oswald Buddenhagen Signed-off-by: Junio C Hamano --- diff --git a/builtin/rebase.c b/builtin/rebase.c index f990811614..41853a0b10 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -386,7 +386,6 @@ static int parse_opt_keep_empty(const struct option *opt, const char *arg, imply_merge(opts, unset ? "--no-keep-empty" : "--keep-empty"); opts->keep_empty = !unset; - opts->type = REBASE_MERGE; return 0; } @@ -1505,9 +1504,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) } } - if (options.type == REBASE_MERGE) - imply_merge(&options, "--merge"); - if (options.root && !options.onto_name) imply_merge(&options, "--root without --onto"); @@ -1552,7 +1548,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (options.type == REBASE_UNSPECIFIED) { if (!strcmp(options.default_backend, "merge")) - imply_merge(&options, "--merge"); + options.type = REBASE_MERGE; else if (!strcmp(options.default_backend, "apply")) options.type = REBASE_APPLY; else