builtin rebase: support `ignore-whitespace` option

This commit adds support for the `--ignore-whitespace` option of the rebase command. This option is simply passed to the `--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 99d8cc7ce8e5175f15050e0a28d896bd6475bf5f
1 file changed +6
builtin/rebase.c
+6
@@ -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_whitespace = 0;
531 struct option builtin_rebase_options[] = {
532 OPT_STRING(0, "onto", &options.onto_name,
533 N_("revision"),
@@ -542,6 +543,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
543 {OPTION_NEGBIT, 'n', "no-stat", &options.flags, NULL,
544 N_("do not show diffstat of what changed upstream"),
545 PARSE_OPT_NOARG, NULL, REBASE_DIFFSTAT },
546 + OPT_BOOL(0, "ignore-whitespace", &ignore_whitespace,
547 + N_("passed to 'git apply'")),
548 OPT_BOOL(0, "signoff", &options.signoff,
549 N_("add a Signed-off-by: line to each commit")),
550 OPT_BOOL(0, "committer-date-is-author-date",
@@ -773,6 +776,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
776 options.flags |= REBASE_FORCE;
777 }
778
779 + if (ignore_whitespace)
780 + strbuf_addstr(&options.git_am_opt, " --ignore-whitespace");
781 +
782 switch (options.type) {
783 case REBASE_MERGE:
784 case REBASE_INTERACTIVE: