@@ -376,20 +376,6 @@ static int run_sequencer_rebase(struct rebase_options *opts)
376
376
return ret ;
377
377
}
378
378
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
-
393
379
static int is_merge (struct rebase_options * opts )
394
380
{
395
381
return opts -> type == REBASE_MERGE ;
@@ -983,6 +969,18 @@ static enum empty_type parse_empty_value(const char *value)
983
969
die (_ ("unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask\"." ), value );
984
970
}
985
971
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
+
986
984
static int parse_opt_empty (const struct option * opt , const char * arg , int unset )
987
985
{
988
986
struct rebase_options * options = opt -> value ;
@@ -1491,23 +1489,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1491
1489
1492
1490
if (options .strategy ) {
1493
1491
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" );
1506
1493
}
1507
1494
1508
- if (options .type == REBASE_MERGE )
1509
- imply_merge (& options , "--merge" );
1510
-
1511
1495
if (options .root && !options .onto_name )
1512
1496
imply_merge (& options , "--root without --onto" );
1513
1497
@@ -1552,7 +1536,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1552
1536
1553
1537
if (options .type == REBASE_UNSPECIFIED ) {
1554
1538
if (!strcmp (options .default_backend , "merge" ))
1555
- imply_merge ( & options , "--merge" ) ;
1539
+ options . type = REBASE_MERGE ;
1556
1540
else if (!strcmp (options .default_backend , "apply" ))
1557
1541
options .type = REBASE_APPLY ;
1558
1542
else
0 commit comments