@@ -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,11 +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 );
119
131
132
+ strbuf_release (& strategy_buf );
120
133
return replay ;
121
134
}
122
135
@@ -512,6 +525,8 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
512
525
argc = parse_options (argc , argv , prefix , options ,
513
526
builtin_rebase_interactive_usage , PARSE_OPT_KEEP_ARGV0 );
514
527
528
+ opts .strategy_opts = xstrdup_or_null (opts .strategy_opts );
529
+
515
530
if (!is_null_oid (& squash_onto ))
516
531
opts .squash_onto = & squash_onto ;
517
532
@@ -965,6 +980,12 @@ static int run_am(struct rebase_options *opts)
965
980
am .git_cmd = 1 ;
966
981
argv_array_push (& am .args , "am" );
967
982
983
+ if (opts -> ignore_whitespace )
984
+ argv_array_push (& am .args , "--ignore-whitespace" );
985
+ if (opts -> committer_date_is_author_date )
986
+ argv_array_push (& opts -> git_am_opts , "--committer-date-is-author-date" );
987
+ if (opts -> ignore_date )
988
+ argv_array_push (& opts -> git_am_opts , "--ignore-date" );
968
989
if (opts -> action && !strcmp ("continue" , opts -> action )) {
969
990
argv_array_push (& am .args , "--resolved" );
970
991
argv_array_pushf (& am .args , "--resolvemsg=%s" , resolvemsg );
@@ -1431,16 +1452,17 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1431
1452
PARSE_OPT_NOARG , NULL , REBASE_DIFFSTAT },
1432
1453
OPT_BOOL (0 , "signoff" , & options .signoff ,
1433
1454
N_ ("add a Signed-off-by: line to each commit" )),
1434
- OPT_PASSTHRU_ARGV (0 , "ignore-whitespace" , & options .git_am_opts ,
1435
- NULL , N_ ("passed to 'git am'" ),
1436
- PARSE_OPT_NOARG ),
1437
- OPT_PASSTHRU_ARGV (0 , "committer-date-is-author-date" ,
1438
- & options .git_am_opts , NULL ,
1439
- N_ ("passed to 'git am'" ), PARSE_OPT_NOARG ),
1440
- OPT_PASSTHRU_ARGV (0 , "ignore-date" , & options .git_am_opts , NULL ,
1441
- N_ ("passed to 'git am'" ), PARSE_OPT_NOARG ),
1455
+ OPT_BOOL (0 , "committer-date-is-author-date" ,
1456
+ & options .committer_date_is_author_date ,
1457
+ N_ ("make committer date match author date" )),
1458
+ OPT_BOOL (0 , "reset-author-date" , & options .ignore_date ,
1459
+ N_ ("ignore author date and use current date" )),
1460
+ OPT_HIDDEN_BOOL (0 , "ignore-date" , & options .ignore_date ,
1461
+ N_ ("synonym of --reset-author-date" )),
1442
1462
OPT_PASSTHRU_ARGV ('C' , NULL , & options .git_am_opts , N_ ("n" ),
1443
1463
N_ ("passed to 'git apply'" ), 0 ),
1464
+ OPT_BOOL (0 , "ignore-whitespace" , & options .ignore_whitespace ,
1465
+ N_ ("ignore changes in whitespace" )),
1444
1466
OPT_PASSTHRU_ARGV (0 , "whitespace" , & options .git_am_opts ,
1445
1467
N_ ("action" ), N_ ("passed to 'git apply'" ), 0 ),
1446
1468
OPT_BIT ('f' , "force-rebase" , & options .flags ,
@@ -1713,11 +1735,13 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1713
1735
state_dir_base , cmd_live_rebase , buf .buf );
1714
1736
}
1715
1737
1738
+ if (options .committer_date_is_author_date ||
1739
+ options .ignore_date )
1740
+ options .flags |= REBASE_FORCE ;
1741
+
1716
1742
for (i = 0 ; i < options .git_am_opts .argc ; i ++ ) {
1717
1743
const char * option = options .git_am_opts .argv [i ], * p ;
1718
- if (!strcmp (option , "--committer-date-is-author-date" ) ||
1719
- !strcmp (option , "--ignore-date" ) ||
1720
- !strcmp (option , "--whitespace=fix" ) ||
1744
+ if (!strcmp (option , "--whitespace=fix" ) ||
1721
1745
!strcmp (option , "--whitespace=strip" ))
1722
1746
options .flags |= REBASE_FORCE ;
1723
1747
else if (skip_prefix (option , "-C" , & p )) {
0 commit comments