@@ -48,8 +48,7 @@ static GIT_PATH_FUNC(merge_dir, "rebase-merge")
48
48
enum rebase_type {
49
49
REBASE_UNSPECIFIED = -1 ,
50
50
REBASE_APPLY ,
51
- REBASE_MERGE ,
52
- REBASE_PRESERVE_MERGES
51
+ REBASE_MERGE
53
52
};
54
53
55
54
enum empty_type {
@@ -571,8 +570,7 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
571
570
572
571
static int is_merge (struct rebase_options * opts )
573
572
{
574
- return opts -> type == REBASE_MERGE ||
575
- opts -> type == REBASE_PRESERVE_MERGES ;
573
+ return opts -> type == REBASE_MERGE ;
576
574
}
577
575
578
576
static void imply_merge (struct rebase_options * opts , const char * option )
@@ -582,7 +580,6 @@ static void imply_merge(struct rebase_options *opts, const char *option)
582
580
die (_ ("%s requires the merge backend" ), option );
583
581
break ;
584
582
case REBASE_MERGE :
585
- case REBASE_PRESERVE_MERGES :
586
583
break ;
587
584
default :
588
585
opts -> type = REBASE_MERGE ; /* implied */
@@ -773,17 +770,6 @@ static struct commit *peel_committish(const char *name)
773
770
return (struct commit * )peel_to_type (name , 0 , obj , OBJ_COMMIT );
774
771
}
775
772
776
- static void add_var (struct strbuf * buf , const char * name , const char * value )
777
- {
778
- if (!value )
779
- strbuf_addf (buf , "unset %s; " , name );
780
- else {
781
- strbuf_addf (buf , "%s=" , name );
782
- sq_quote_buf (buf , value );
783
- strbuf_addstr (buf , "; " );
784
- }
785
- }
786
-
787
773
static int move_to_original_branch (struct rebase_options * opts )
788
774
{
789
775
struct strbuf orig_head_reflog = STRBUF_INIT , head_reflog = STRBUF_INIT ;
@@ -940,10 +926,8 @@ static int run_am(struct rebase_options *opts)
940
926
941
927
static int run_specific_rebase (struct rebase_options * opts , enum action action )
942
928
{
943
- const char * argv [] = { NULL , NULL };
944
- struct strbuf script_snippet = STRBUF_INIT , buf = STRBUF_INIT ;
929
+ struct strbuf script_snippet = STRBUF_INIT ;
945
930
int status ;
946
- const char * backend , * backend_func ;
947
931
948
932
if (opts -> type == REBASE_MERGE ) {
949
933
/* Run sequencer-based rebase */
@@ -960,87 +944,11 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
960
944
}
961
945
962
946
status = run_sequencer_rebase (opts , action );
963
- goto finished_rebase ;
964
- }
965
-
966
- if (opts -> type == REBASE_APPLY ) {
947
+ } else if (opts -> type == REBASE_APPLY )
967
948
status = run_am (opts );
968
- goto finished_rebase ;
969
- }
970
-
971
- add_var (& script_snippet , "GIT_DIR" , absolute_path (get_git_dir ()));
972
- add_var (& script_snippet , "state_dir" , opts -> state_dir );
973
-
974
- add_var (& script_snippet , "upstream_name" , opts -> upstream_name );
975
- add_var (& script_snippet , "upstream" , opts -> upstream ?
976
- oid_to_hex (& opts -> upstream -> object .oid ) : NULL );
977
- add_var (& script_snippet , "head_name" ,
978
- opts -> head_name ? opts -> head_name : "detached HEAD" );
979
- add_var (& script_snippet , "orig_head" , oid_to_hex (& opts -> orig_head ));
980
- add_var (& script_snippet , "onto" , opts -> onto ?
981
- oid_to_hex (& opts -> onto -> object .oid ) : NULL );
982
- add_var (& script_snippet , "onto_name" , opts -> onto_name );
983
- add_var (& script_snippet , "revisions" , opts -> revisions );
984
- add_var (& script_snippet , "restrict_revision" , opts -> restrict_revision ?
985
- oid_to_hex (& opts -> restrict_revision -> object .oid ) : NULL );
986
- sq_quote_argv_pretty (& buf , opts -> git_am_opts .v );
987
- add_var (& script_snippet , "git_am_opt" , buf .buf );
988
- strbuf_release (& buf );
989
- add_var (& script_snippet , "verbose" ,
990
- opts -> flags & REBASE_VERBOSE ? "t" : "" );
991
- add_var (& script_snippet , "diffstat" ,
992
- opts -> flags & REBASE_DIFFSTAT ? "t" : "" );
993
- add_var (& script_snippet , "force_rebase" ,
994
- opts -> flags & REBASE_FORCE ? "t" : "" );
995
- if (opts -> switch_to )
996
- add_var (& script_snippet , "switch_to" , opts -> switch_to );
997
- add_var (& script_snippet , "action" , opts -> action ? opts -> action : "" );
998
- add_var (& script_snippet , "signoff" , opts -> signoff ? "--signoff" : "" );
999
- add_var (& script_snippet , "allow_rerere_autoupdate" ,
1000
- opts -> allow_rerere_autoupdate ?
1001
- opts -> allow_rerere_autoupdate == RERERE_AUTOUPDATE ?
1002
- "--rerere-autoupdate" : "--no-rerere-autoupdate" : "" );
1003
- add_var (& script_snippet , "keep_empty" , opts -> keep_empty ? "yes" : "" );
1004
- add_var (& script_snippet , "autosquash" , opts -> autosquash ? "t" : "" );
1005
- add_var (& script_snippet , "gpg_sign_opt" , opts -> gpg_sign_opt );
1006
- add_var (& script_snippet , "cmd" , opts -> cmd );
1007
- add_var (& script_snippet , "allow_empty_message" ,
1008
- opts -> allow_empty_message ? "--allow-empty-message" : "" );
1009
- add_var (& script_snippet , "rebase_merges" ,
1010
- opts -> rebase_merges ? "t" : "" );
1011
- add_var (& script_snippet , "rebase_cousins" ,
1012
- opts -> rebase_cousins ? "t" : "" );
1013
- add_var (& script_snippet , "strategy" , opts -> strategy );
1014
- add_var (& script_snippet , "strategy_opts" , opts -> strategy_opts );
1015
- add_var (& script_snippet , "rebase_root" , opts -> root ? "t" : "" );
1016
- add_var (& script_snippet , "squash_onto" ,
1017
- opts -> squash_onto ? oid_to_hex (opts -> squash_onto ) : "" );
1018
- add_var (& script_snippet , "git_format_patch_opt" ,
1019
- opts -> git_format_patch_opt .buf );
1020
-
1021
- if (is_merge (opts ) &&
1022
- !(opts -> flags & REBASE_INTERACTIVE_EXPLICIT )) {
1023
- strbuf_addstr (& script_snippet ,
1024
- "GIT_SEQUENCE_EDITOR=:; export GIT_SEQUENCE_EDITOR; " );
1025
- opts -> autosquash = 0 ;
1026
- }
1027
-
1028
- switch (opts -> type ) {
1029
- case REBASE_PRESERVE_MERGES :
1030
- backend = "git-rebase--preserve-merges" ;
1031
- backend_func = "git_rebase__preserve_merges" ;
1032
- break ;
1033
- default :
949
+ else
1034
950
BUG ("Unhandled rebase type %d" , opts -> type );
1035
- break ;
1036
- }
1037
951
1038
- strbuf_addf (& script_snippet ,
1039
- ". git-sh-setup && . %s && %s" , backend , backend_func );
1040
- argv [0 ] = script_snippet .buf ;
1041
-
1042
- status = run_command_v_opt (argv , RUN_USING_SHELL );
1043
- finished_rebase :
1044
952
if (opts -> dont_finish_rebase )
1045
953
; /* do nothing */
1046
954
else if (opts -> type == REBASE_MERGE )
@@ -1377,10 +1285,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1377
1285
N_ ("let the user edit the list of commits to rebase" ),
1378
1286
PARSE_OPT_NOARG | PARSE_OPT_NONEG ,
1379
1287
parse_opt_interactive ),
1380
- OPT_SET_INT_F ('p' , "preserve-merges" , & options .type ,
1381
- N_ ("(DEPRECATED) try to recreate merges instead of "
1382
- "ignoring them" ),
1383
- REBASE_PRESERVE_MERGES , PARSE_OPT_HIDDEN ),
1384
1288
OPT_RERERE_AUTOUPDATE (& options .allow_rerere_autoupdate ),
1385
1289
OPT_CALLBACK_F (0 , "empty" , & options , "{drop,keep,ask}" ,
1386
1290
N_ ("how to handle commits that become empty" ),
@@ -1448,8 +1352,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1448
1352
strbuf_reset (& buf );
1449
1353
strbuf_addf (& buf , "%s/rewritten" , merge_dir ());
1450
1354
if (is_directory (buf .buf )) {
1451
- options .type = REBASE_PRESERVE_MERGES ;
1452
- options .flags |= REBASE_INTERACTIVE_EXPLICIT ;
1355
+ die ("`rebase -p` is no longer supported" );
1453
1356
} else {
1454
1357
strbuf_reset (& buf );
1455
1358
strbuf_addf (& buf , "%s/interactive" , merge_dir ());
@@ -1479,10 +1382,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1479
1382
usage_with_options (builtin_rebase_usage ,
1480
1383
builtin_rebase_options );
1481
1384
1482
- if (options .type == REBASE_PRESERVE_MERGES )
1483
- warning (_ ("git rebase --preserve-merges is deprecated. "
1484
- "Use --rebase-merges instead." ));
1485
-
1486
1385
if (keep_base ) {
1487
1386
if (options .onto_name )
1488
1387
die (_ ("cannot combine '--keep-base' with '--onto'" ));
@@ -1728,7 +1627,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1728
1627
case REBASE_APPLY :
1729
1628
die (_ ("--strategy requires --merge or --interactive" ));
1730
1629
case REBASE_MERGE :
1731
- case REBASE_PRESERVE_MERGES :
1732
1630
/* compatible */
1733
1631
break ;
1734
1632
case REBASE_UNSPECIFIED :
@@ -1780,7 +1678,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1780
1678
1781
1679
switch (options .type ) {
1782
1680
case REBASE_MERGE :
1783
- case REBASE_PRESERVE_MERGES :
1784
1681
options .state_dir = merge_dir ();
1785
1682
break ;
1786
1683
case REBASE_APPLY :
@@ -1805,28 +1702,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1805
1702
options .reschedule_failed_exec = reschedule_failed_exec ;
1806
1703
1807
1704
if (options .signoff ) {
1808
- if (options .type == REBASE_PRESERVE_MERGES )
1809
- die ("cannot combine '--signoff' with "
1810
- "'--preserve-merges'" );
1811
1705
strvec_push (& options .git_am_opts , "--signoff" );
1812
1706
options .flags |= REBASE_FORCE ;
1813
1707
}
1814
1708
1815
- if (options .type == REBASE_PRESERVE_MERGES ) {
1816
- /*
1817
- * Note: incompatibility with --signoff handled in signoff block above
1818
- * Note: incompatibility with --interactive is just a strong warning;
1819
- * git-rebase.txt caveats with "unless you know what you are doing"
1820
- */
1821
- if (options .rebase_merges )
1822
- die (_ ("cannot combine '--preserve-merges' with "
1823
- "'--rebase-merges'" ));
1824
-
1825
- if (options .reschedule_failed_exec )
1826
- die (_ ("error: cannot combine '--preserve-merges' with "
1827
- "'--reschedule-failed-exec'" ));
1828
- }
1829
-
1830
1709
if (!options .root ) {
1831
1710
if (argc < 1 ) {
1832
1711
struct branch * branch ;
0 commit comments