builtin rebase: support `ignore-date` option

This commit adds support for `--ignore-date` which is passed to `git am` to easily change the dates of the rebased commits. Signed-off-by: Pratik Karki <predatoramigo@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pratik Karki committed Sep 4, 2018 at 14:59 UTC 53f9e5be94e64e10114e521dd2389495baaeb00d
1 file changed +8
builtin/rebase.c
+8
@@ -527,6 +527,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
527 ACTION_SHOW_CURRENT_PATCH,
528 } action = NO_ACTION;
529 int committer_date_is_author_date = 0;
530 + int ignore_date = 0;
531 int ignore_whitespace = 0;
532 struct option builtin_rebase_options[] = {
533 OPT_STRING(0, "onto", &options.onto_name,
@@ -550,6 +551,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
551 OPT_BOOL(0, "committer-date-is-author-date",
552 &committer_date_is_author_date,
553 N_("passed to 'git am'")),
554 + OPT_BOOL(0, "ignore-date", &ignore_date,
555 + N_("passed to 'git am'")),
556 OPT_BIT('f', "force-rebase", &options.flags,
557 N_("cherry-pick all commits, even if unchanged"),
558 REBASE_FORCE),
@@ -779,6 +782,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
782 if (ignore_whitespace)
783 strbuf_addstr(&options.git_am_opt, " --ignore-whitespace");
784
785 + if (ignore_date) {
786 + strbuf_addstr(&options.git_am_opt, " --ignore-date");
787 + options.flags |= REBASE_FORCE;
788 + }
789 +
790 switch (options.type) {
791 case REBASE_MERGE:
792 case REBASE_INTERACTIVE: