@@ -79,8 +79,11 @@ struct rebase_options {
7979 int allow_rerere_autoupdate ;
8080 int keep_empty ;
8181 int autosquash ;
82+ int ignore_whitespace ;
8283 char * gpg_sign_opt ;
8384 int autostash ;
85+ int committer_date_is_author_date ;
86+ int ignore_date ;
8487 char * cmd ;
8588 int allow_empty_message ;
8689 int rebase_merges , rebase_cousins ;
@@ -99,6 +102,7 @@ struct rebase_options {
99102
100103static struct replay_opts get_replay_opts (const struct rebase_options * opts )
101104{
105+ struct strbuf strategy_buf = STRBUF_INIT ;
102106 struct replay_opts replay = REPLAY_OPTS_INIT ;
103107
104108 replay .action = REPLAY_INTERACTIVE_REBASE ;
@@ -112,11 +116,20 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
112116 replay .allow_empty_message = opts -> allow_empty_message ;
113117 replay .verbose = opts -> flags & REBASE_VERBOSE ;
114118 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 ;
115122 replay .gpg_sign = xstrdup_or_null (opts -> gpg_sign_opt );
116123 replay .strategy = opts -> strategy ;
124+
117125 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 );
119131
132+ strbuf_release (& strategy_buf );
120133 return replay ;
121134}
122135
@@ -512,6 +525,8 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
512525 argc = parse_options (argc , argv , prefix , options ,
513526 builtin_rebase_interactive_usage , PARSE_OPT_KEEP_ARGV0 );
514527
528+ opts .strategy_opts = xstrdup_or_null (opts .strategy_opts );
529+
515530 if (!is_null_oid (& squash_onto ))
516531 opts .squash_onto = & squash_onto ;
517532
@@ -965,6 +980,12 @@ static int run_am(struct rebase_options *opts)
965980 am .git_cmd = 1 ;
966981 argv_array_push (& am .args , "am" );
967982
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" );
968989 if (opts -> action && !strcmp ("continue" , opts -> action )) {
969990 argv_array_push (& am .args , "--resolved" );
970991 argv_array_pushf (& am .args , "--resolvemsg=%s" , resolvemsg );
@@ -1431,16 +1452,17 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
14311452 PARSE_OPT_NOARG , NULL , REBASE_DIFFSTAT },
14321453 OPT_BOOL (0 , "signoff" , & options .signoff ,
14331454 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" )),
14421462 OPT_PASSTHRU_ARGV ('C' , NULL , & options .git_am_opts , N_ ("n" ),
14431463 N_ ("passed to 'git apply'" ), 0 ),
1464+ OPT_BOOL (0 , "ignore-whitespace" , & options .ignore_whitespace ,
1465+ N_ ("ignore changes in whitespace" )),
14441466 OPT_PASSTHRU_ARGV (0 , "whitespace" , & options .git_am_opts ,
14451467 N_ ("action" ), N_ ("passed to 'git apply'" ), 0 ),
14461468 OPT_BIT ('f' , "force-rebase" , & options .flags ,
@@ -1713,11 +1735,13 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
17131735 state_dir_base , cmd_live_rebase , buf .buf );
17141736 }
17151737
1738+ if (options .committer_date_is_author_date ||
1739+ options .ignore_date )
1740+ options .flags |= REBASE_FORCE ;
1741+
17161742 for (i = 0 ; i < options .git_am_opts .argc ; i ++ ) {
17171743 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" ) ||
17211745 !strcmp (option , "--whitespace=strip" ))
17221746 options .flags |= REBASE_FORCE ;
17231747 else if (skip_prefix (option , "-C" , & p )) {
0 commit comments