@@ -102,6 +102,7 @@ struct rebase_options {
102
102
int reschedule_failed_exec ;
103
103
int use_legacy_rebase ;
104
104
int reapply_cherry_picks ;
105
+ int fork_point ;
105
106
};
106
107
107
108
#define REBASE_OPTIONS_INIT { \
@@ -111,7 +112,8 @@ struct rebase_options {
111
112
.default_backend = "merge", \
112
113
.flags = REBASE_NO_QUIET, \
113
114
.git_am_opts = STRVEC_INIT, \
114
- .git_format_patch_opt = STRBUF_INIT \
115
+ .git_format_patch_opt = STRBUF_INIT, \
116
+ .fork_point = -1, \
115
117
}
116
118
117
119
static struct replay_opts get_replay_opts (const struct rebase_options * opts )
@@ -1095,6 +1097,11 @@ static int rebase_config(const char *var, const char *value, void *data)
1095
1097
return 0 ;
1096
1098
}
1097
1099
1100
+ if (!strcmp (var , "rebase.forkpoint" )) {
1101
+ opts -> fork_point = git_config_bool (var , value ) ? -1 : 0 ;
1102
+ return 0 ;
1103
+ }
1104
+
1098
1105
if (!strcmp (var , "rebase.usebuiltin" )) {
1099
1106
opts -> use_legacy_rebase = !git_config_bool (var , value );
1100
1107
return 0 ;
@@ -1306,7 +1313,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1306
1313
const char * gpg_sign = NULL ;
1307
1314
struct string_list exec = STRING_LIST_INIT_NODUP ;
1308
1315
const char * rebase_merges = NULL ;
1309
- int fork_point = -1 ;
1310
1316
struct string_list strategy_options = STRING_LIST_INIT_NODUP ;
1311
1317
struct object_id squash_onto ;
1312
1318
char * squash_onto_name = NULL ;
@@ -1406,7 +1412,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1406
1412
N_ ("mode" ),
1407
1413
N_ ("try to rebase merges instead of skipping them" ),
1408
1414
PARSE_OPT_OPTARG , NULL , (intptr_t )"" },
1409
- OPT_BOOL (0 , "fork-point" , & fork_point ,
1415
+ OPT_BOOL (0 , "fork-point" , & options . fork_point ,
1410
1416
N_ ("use 'merge-base --fork-point' to refine upstream" )),
1411
1417
OPT_STRING ('s' , "strategy" , & options .strategy ,
1412
1418
N_ ("strategy" ), N_ ("use the given merge strategy" )),
@@ -1494,7 +1500,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1494
1500
die (_ ("cannot combine '--keep-base' with '--root'" ));
1495
1501
}
1496
1502
1497
- if (options .root && fork_point > 0 )
1503
+ if (options .root && options . fork_point > 0 )
1498
1504
die (_ ("cannot combine '--root' with '--fork-point'" ));
1499
1505
1500
1506
if (action != ACTION_NONE && !in_progress )
@@ -1840,8 +1846,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1840
1846
NULL );
1841
1847
if (!options .upstream_name )
1842
1848
error_on_missing_default_upstream ();
1843
- if (fork_point < 0 )
1844
- fork_point = 1 ;
1849
+ if (options . fork_point < 0 )
1850
+ options . fork_point = 1 ;
1845
1851
} else {
1846
1852
options .upstream_name = argv [0 ];
1847
1853
argc -- ;
@@ -1945,7 +1951,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1945
1951
} else
1946
1952
BUG ("unexpected number of arguments left to parse" );
1947
1953
1948
- if (fork_point > 0 ) {
1954
+ if (options . fork_point > 0 ) {
1949
1955
struct commit * head =
1950
1956
lookup_commit_reference (the_repository ,
1951
1957
& options .orig_head );
0 commit comments