builtin rebase: support --committer-date-is-author-date

This option is simply handed down to `git am` by way of setting the `git_am_opt` variable that is handled by the `git-rebase--am` backend. 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 38dbcef26e855062b4ae58bd7187bfbf01e21566
1 file changed +10
builtin/rebase.c
+10
@@ -526,6 +526,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
526 ACTION_EDIT_TODO,
527 ACTION_SHOW_CURRENT_PATCH,
528 } action = NO_ACTION;
529 + int committer_date_is_author_date = 0;
530 struct option builtin_rebase_options[] = {
531 OPT_STRING(0, "onto", &options.onto_name,
532 N_("revision"),
@@ -543,6 +544,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
544 PARSE_OPT_NOARG, NULL, REBASE_DIFFSTAT },
545 OPT_BOOL(0, "signoff", &options.signoff,
546 N_("add a Signed-off-by: line to each commit")),
547 + OPT_BOOL(0, "committer-date-is-author-date",
548 + &committer_date_is_author_date,
549 + N_("passed to 'git am'")),
550 OPT_BIT('f', "force-rebase", &options.flags,
551 N_("cherry-pick all commits, even if unchanged"),
552 REBASE_FORCE),
@@ -763,6 +767,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
767 if (!(options.flags & REBASE_NO_QUIET))
768 strbuf_addstr(&options.git_am_opt, " -q");
769
770 + if (committer_date_is_author_date) {
771 + strbuf_addstr(&options.git_am_opt,
772 + " --committer-date-is-author-date");
773 + options.flags |= REBASE_FORCE;
774 + }
775 +
776 switch (options.type) {
777 case REBASE_MERGE:
778 case REBASE_INTERACTIVE: