@@ -92,6 +92,8 @@ struct rebase_options {
9292 int autosquash ;
9393 char * gpg_sign_opt ;
9494 int autostash ;
95+ int committer_date_is_author_date ;
96+ int ignore_date ;
9597 char * cmd ;
9698 int allow_empty_message ;
9799 int rebase_merges , rebase_cousins ;
@@ -130,8 +132,12 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
130132 replay .quiet = !(opts -> flags & REBASE_NO_QUIET );
131133 replay .verbose = opts -> flags & REBASE_VERBOSE ;
132134 replay .reschedule_failed_exec = opts -> reschedule_failed_exec ;
135+ replay .committer_date_is_author_date =
136+ opts -> committer_date_is_author_date ;
137+ replay .ignore_date = opts -> ignore_date ;
133138 replay .gpg_sign = xstrdup_or_null (opts -> gpg_sign_opt );
134139 replay .strategy = opts -> strategy ;
140+
135141 if (opts -> strategy_opts )
136142 parse_strategy_opts (& replay , opts -> strategy_opts );
137143
@@ -1289,6 +1295,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
12891295 struct strbuf revisions = STRBUF_INIT ;
12901296 struct strbuf buf = STRBUF_INIT ;
12911297 struct object_id merge_base ;
1298+ int ignore_whitespace = 0 ;
12921299 enum action action = ACTION_NONE ;
12931300 const char * gpg_sign = NULL ;
12941301 struct string_list exec = STRING_LIST_INIT_NODUP ;
@@ -1318,16 +1325,17 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
13181325 PARSE_OPT_NOARG , NULL , REBASE_DIFFSTAT },
13191326 OPT_BOOL (0 , "signoff" , & options .signoff ,
13201327 N_ ("add a Signed-off-by: line to each commit" )),
1321- OPT_PASSTHRU_ARGV (0 , "ignore-whitespace" , & options .git_am_opts ,
1322- NULL , N_ ("passed to 'git am'" ),
1323- PARSE_OPT_NOARG ),
1324- OPT_PASSTHRU_ARGV (0 , "committer-date-is-author-date" ,
1325- & options .git_am_opts , NULL ,
1326- N_ ("passed to 'git am'" ), PARSE_OPT_NOARG ),
1327- OPT_PASSTHRU_ARGV (0 , "ignore-date" , & options .git_am_opts , NULL ,
1328- N_ ("passed to 'git am'" ), PARSE_OPT_NOARG ),
1328+ OPT_BOOL (0 , "committer-date-is-author-date" ,
1329+ & options .committer_date_is_author_date ,
1330+ N_ ("make committer date match author date" )),
1331+ OPT_BOOL (0 , "reset-author-date" , & options .ignore_date ,
1332+ N_ ("ignore author date and use current date" )),
1333+ OPT_HIDDEN_BOOL (0 , "ignore-date" , & options .ignore_date ,
1334+ N_ ("synonym of --reset-author-date" )),
13291335 OPT_PASSTHRU_ARGV ('C' , NULL , & options .git_am_opts , N_ ("n" ),
13301336 N_ ("passed to 'git apply'" ), 0 ),
1337+ OPT_BOOL (0 , "ignore-whitespace" , & ignore_whitespace ,
1338+ N_ ("ignore changes in whitespace" )),
13311339 OPT_PASSTHRU_ARGV (0 , "whitespace" , & options .git_am_opts ,
13321340 N_ ("action" ), N_ ("passed to 'git apply'" ), 0 ),
13331341 OPT_BIT ('f' , "force-rebase" , & options .flags ,
@@ -1624,12 +1632,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
16241632 options .autosquash ) {
16251633 allow_preemptive_ff = 0 ;
16261634 }
1635+ if (options .committer_date_is_author_date || options .ignore_date )
1636+ options .flags |= REBASE_FORCE ;
16271637
16281638 for (i = 0 ; i < options .git_am_opts .nr ; i ++ ) {
16291639 const char * option = options .git_am_opts .v [i ], * p ;
1630- if (!strcmp (option , "--committer-date-is-author-date" ) ||
1631- !strcmp (option , "--ignore-date" ) ||
1632- !strcmp (option , "--whitespace=fix" ) ||
1640+ if (!strcmp (option , "--whitespace=fix" ) ||
16331641 !strcmp (option , "--whitespace=strip" ))
16341642 allow_preemptive_ff = 0 ;
16351643 else if (skip_prefix (option , "-C" , & p )) {
@@ -1682,6 +1690,23 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
16821690 imply_merge (& options , "--rebase-merges" );
16831691 }
16841692
1693+ if (options .type == REBASE_APPLY ) {
1694+ if (ignore_whitespace )
1695+ strvec_push (& options .git_am_opts ,
1696+ "--ignore-whitespace" );
1697+ if (options .committer_date_is_author_date )
1698+ strvec_push (& options .git_am_opts ,
1699+ "--committer-date-is-author-date" );
1700+ if (options .ignore_date )
1701+ strvec_push (& options .git_am_opts , "--ignore-date" );
1702+ } else {
1703+ /* REBASE_MERGE and PRESERVE_MERGES */
1704+ if (ignore_whitespace ) {
1705+ string_list_append (& strategy_options ,
1706+ "ignore-space-change" );
1707+ }
1708+ }
1709+
16851710 if (strategy_options .nr ) {
16861711 int i ;
16871712
0 commit comments