@@ -376,20 +376,6 @@ static int run_sequencer_rebase(struct rebase_options *opts)
376376 return ret ;
377377}
378378
379- static void imply_merge (struct rebase_options * opts , const char * option );
380- static int parse_opt_keep_empty (const struct option * opt , const char * arg ,
381- int unset )
382- {
383- struct rebase_options * opts = opt -> value ;
384-
385- BUG_ON_OPT_ARG (arg );
386-
387- imply_merge (opts , unset ? "--no-keep-empty" : "--keep-empty" );
388- opts -> keep_empty = !unset ;
389- opts -> type = REBASE_MERGE ;
390- return 0 ;
391- }
392-
393379static int is_merge (struct rebase_options * opts )
394380{
395381 return opts -> type == REBASE_MERGE ;
@@ -983,6 +969,18 @@ static enum empty_type parse_empty_value(const char *value)
983969 die (_ ("unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask\"." ), value );
984970}
985971
972+ static int parse_opt_keep_empty (const struct option * opt , const char * arg ,
973+ int unset )
974+ {
975+ struct rebase_options * opts = opt -> value ;
976+
977+ BUG_ON_OPT_ARG (arg );
978+
979+ imply_merge (opts , unset ? "--no-keep-empty" : "--keep-empty" );
980+ opts -> keep_empty = !unset ;
981+ return 0 ;
982+ }
983+
986984static int parse_opt_empty (const struct option * opt , const char * arg , int unset )
987985{
988986 struct rebase_options * options = opt -> value ;
@@ -1491,23 +1489,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
14911489
14921490 if (options .strategy ) {
14931491 options .strategy = xstrdup (options .strategy );
1494- switch (options .type ) {
1495- case REBASE_APPLY :
1496- die (_ ("--strategy requires --merge or --interactive" ));
1497- case REBASE_MERGE :
1498- /* compatible */
1499- break ;
1500- case REBASE_UNSPECIFIED :
1501- options .type = REBASE_MERGE ;
1502- break ;
1503- default :
1504- BUG ("unhandled rebase type (%d)" , options .type );
1505- }
1492+ imply_merge (& options , "--strategy" );
15061493 }
15071494
1508- if (options .type == REBASE_MERGE )
1509- imply_merge (& options , "--merge" );
1510-
15111495 if (options .root && !options .onto_name )
15121496 imply_merge (& options , "--root without --onto" );
15131497
@@ -1552,7 +1536,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
15521536
15531537 if (options .type == REBASE_UNSPECIFIED ) {
15541538 if (!strcmp (options .default_backend , "merge" ))
1555- imply_merge ( & options , "--merge" ) ;
1539+ options . type = REBASE_MERGE ;
15561540 else if (!strcmp (options .default_backend , "apply" ))
15571541 options .type = REBASE_APPLY ;
15581542 else
0 commit comments