@@ -79,8 +79,11 @@ struct rebase_options {
79
79
int allow_rerere_autoupdate ;
80
80
int keep_empty ;
81
81
int autosquash ;
82
+ int ignore_whitespace ;
82
83
char * gpg_sign_opt ;
83
84
int autostash ;
85
+ int committer_date_is_author_date ;
86
+ int ignore_date ;
84
87
char * cmd ;
85
88
int allow_empty_message ;
86
89
int rebase_merges , rebase_cousins ;
@@ -99,6 +102,7 @@ struct rebase_options {
99
102
100
103
static struct replay_opts get_replay_opts (const struct rebase_options * opts )
101
104
{
105
+ struct strbuf strategy_buf = STRBUF_INIT ;
102
106
struct replay_opts replay = REPLAY_OPTS_INIT ;
103
107
104
108
replay .action = REPLAY_INTERACTIVE_REBASE ;
@@ -112,10 +116,20 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
112
116
replay .allow_empty_message = opts -> allow_empty_message ;
113
117
replay .verbose = opts -> flags & REBASE_VERBOSE ;
114
118
replay .reschedule_failed_exec = opts -> reschedule_failed_exec ;
119
+ replay .committer_date_is_author_date =
120
+ opts -> committer_date_is_author_date ;
121
+ replay .ignore_date = opts -> ignore_date ;
115
122
replay .gpg_sign = xstrdup_or_null (opts -> gpg_sign_opt );
116
123
replay .strategy = opts -> strategy ;
124
+
117
125
if (opts -> strategy_opts )
118
- parse_strategy_opts (& replay , opts -> strategy_opts );
126
+ strbuf_addstr (& strategy_buf , opts -> strategy_opts );
127
+ if (opts -> ignore_whitespace )
128
+ strbuf_addstr (& strategy_buf , " --ignore-space-change" );
129
+ if (strategy_buf .len )
130
+ parse_strategy_opts (& replay , strategy_buf .buf );
131
+
132
+ strbuf_release (& strategy_buf );
119
133
120
134
if (opts -> squash_onto ) {
121
135
oidcpy (& replay .squash_onto , opts -> squash_onto );
@@ -517,6 +531,8 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
517
531
argc = parse_options (argc , argv , prefix , options ,
518
532
builtin_rebase_interactive_usage , PARSE_OPT_KEEP_ARGV0 );
519
533
534
+ opts .strategy_opts = xstrdup_or_null (opts .strategy_opts );
535
+
520
536
if (!is_null_oid (& squash_onto ))
521
537
opts .squash_onto = & squash_onto ;
522
538
@@ -970,6 +986,12 @@ static int run_am(struct rebase_options *opts)
970
986
am .git_cmd = 1 ;
971
987
argv_array_push (& am .args , "am" );
972
988
989
+ if (opts -> ignore_whitespace )
990
+ argv_array_push (& am .args , "--ignore-whitespace" );
991
+ if (opts -> committer_date_is_author_date )
992
+ argv_array_push (& opts -> git_am_opts , "--committer-date-is-author-date" );
993
+ if (opts -> ignore_date )
994
+ argv_array_push (& opts -> git_am_opts , "--ignore-date" );
973
995
if (opts -> action && !strcmp ("continue" , opts -> action )) {
974
996
argv_array_push (& am .args , "--resolved" );
975
997
argv_array_pushf (& am .args , "--resolvemsg=%s" , resolvemsg );
@@ -1436,16 +1458,17 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1436
1458
PARSE_OPT_NOARG , NULL , REBASE_DIFFSTAT },
1437
1459
OPT_BOOL (0 , "signoff" , & options .signoff ,
1438
1460
N_ ("add a Signed-off-by: line to each commit" )),
1439
- OPT_PASSTHRU_ARGV (0 , "ignore-whitespace" , & options .git_am_opts ,
1440
- NULL , N_ ("passed to 'git am'" ),
1441
- PARSE_OPT_NOARG ),
1442
- OPT_PASSTHRU_ARGV (0 , "committer-date-is-author-date" ,
1443
- & options .git_am_opts , NULL ,
1444
- N_ ("passed to 'git am'" ), PARSE_OPT_NOARG ),
1445
- OPT_PASSTHRU_ARGV (0 , "ignore-date" , & options .git_am_opts , NULL ,
1446
- N_ ("passed to 'git am'" ), PARSE_OPT_NOARG ),
1461
+ OPT_BOOL (0 , "committer-date-is-author-date" ,
1462
+ & options .committer_date_is_author_date ,
1463
+ N_ ("make committer date match author date" )),
1464
+ OPT_BOOL (0 , "reset-author-date" , & options .ignore_date ,
1465
+ "ignore author date and use current date" ),
1466
+ OPT_BOOL (0 , "ignore-date" , & options .ignore_date ,
1467
+ "ignore author date and use current date" ),
1447
1468
OPT_PASSTHRU_ARGV ('C' , NULL , & options .git_am_opts , N_ ("n" ),
1448
1469
N_ ("passed to 'git apply'" ), 0 ),
1470
+ OPT_BOOL (0 , "ignore-whitespace" , & options .ignore_whitespace ,
1471
+ N_ ("ignore changes in whitespace" )),
1449
1472
OPT_PASSTHRU_ARGV (0 , "whitespace" , & options .git_am_opts ,
1450
1473
N_ ("action" ), N_ ("passed to 'git apply'" ), 0 ),
1451
1474
OPT_BIT ('f' , "force-rebase" , & options .flags ,
@@ -1718,11 +1741,13 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1718
1741
state_dir_base , cmd_live_rebase , buf .buf );
1719
1742
}
1720
1743
1744
+ if (options .committer_date_is_author_date ||
1745
+ options .ignore_date )
1746
+ options .flags |= REBASE_FORCE ;
1747
+
1721
1748
for (i = 0 ; i < options .git_am_opts .argc ; i ++ ) {
1722
1749
const char * option = options .git_am_opts .argv [i ], * p ;
1723
- if (!strcmp (option , "--committer-date-is-author-date" ) ||
1724
- !strcmp (option , "--ignore-date" ) ||
1725
- !strcmp (option , "--whitespace=fix" ) ||
1750
+ if (!strcmp (option , "--whitespace=fix" ) ||
1726
1751
!strcmp (option , "--whitespace=strip" ))
1727
1752
options .flags |= REBASE_FORCE ;
1728
1753
else if (skip_prefix (option , "-C" , & p )) {
0 commit comments