From: Elijah Newren <newren@xxxxxxxxx> The `-C` option to rebase was introduced with 67dad687ad ("add -C[NUM] to git-am", 2007-02-08). Based on feedback on the patch, the author added the -C option not just to git-am but also to git-rebase. But did it such that the option was just passed through to git-am (which passes it along to git-apply), with no corresponding option to format-patch. As per the git-apply documentation for the `-C` option: Ensure at least <n> lines of surrounding context match...When fewer lines of surrounding context exist they all must match. The fact that format-patch was not passed a -U option to increase the number of context lines meant that there would still only be 3 lines of context to match on. So, anyone attempting to use this option in git-rebase would just be spinning their wheels and wasting time. I was one such user a number of years ago. Since this option can at best waste users time and is nothing more than a confusing no-op, and has never been anything other than a confusing no-op, and no one has ever bothered to create a testcase for it that goes beyond option parsing, simply excise the option. Signed-off-by: Elijah Newren <newren@xxxxxxxxx> --- Documentation/git-rebase.txt | 9 --------- builtin/rebase.c | 9 +-------- t/t3406-rebase-message.sh | 7 ------- t/t3422-rebase-incompatible-options.sh | 1 - 4 files changed, 1 insertion(+), 25 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index f9675bd24e6..412887deda7 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -416,14 +416,6 @@ include::rerere-options.txt[] Allows the pre-rebase hook to run, which is the default. This option can be used to override `--no-verify`. See also linkgit:githooks[5]. --C<n>:: - Ensure at least `<n>` lines of surrounding context match before - and after each change. When fewer lines of surrounding - context exist they all must match. By default no context is - ever ignored. Implies `--apply`. -+ -See also INCOMPATIBLE OPTIONS below. - --no-ff:: --force-rebase:: -f:: @@ -631,7 +623,6 @@ The following options: * --apply * --whitespace - * -C are incompatible with the following options: diff --git a/builtin/rebase.c b/builtin/rebase.c index 1481c5b6a5b..ace8bd4a41c 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1067,8 +1067,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) N_("ignore author date and use current date")), OPT_HIDDEN_BOOL(0, "ignore-date", &options.ignore_date, N_("synonym of --reset-author-date")), - OPT_PASSTHRU_ARGV('C', NULL, &options.git_am_opts, N_("n"), - N_("passed to 'git apply'"), 0), OPT_BOOL(0, "ignore-whitespace", &ignore_whitespace, N_("ignore changes in whitespace")), OPT_PASSTHRU_ARGV(0, "whitespace", &options.git_am_opts, @@ -1390,12 +1388,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (!strcmp(option, "--whitespace=fix") || !strcmp(option, "--whitespace=strip")) allow_preemptive_ff = 0; - else if (skip_prefix(option, "-C", &p)) { - while (*p) - if (!isdigit(*(p++))) - die(_("switch `C' expects a " - "numerical value")); - } else if (skip_prefix(option, "--whitespace=", &p)) { + else if (skip_prefix(option, "--whitespace=", &p)) { if (*p && strcmp(p, "warn") && strcmp(p, "nowarn") && strcmp(p, "error") && strcmp(p, "error-all")) die("Invalid whitespace option: '%s'", p); diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh index ceca1600053..c8dca845dd7 100755 --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@ -78,13 +78,6 @@ test_expect_success 'rebase --onto outputs the invalid ref' ' test_i18ngrep "invalid-ref" err ' -test_expect_success 'error out early upon -C<n> or --whitespace=<bad>' ' - test_must_fail git rebase -Cnot-a-number HEAD 2>err && - test_i18ngrep "numerical value" err && - test_must_fail git rebase --whitespace=bad HEAD 2>err && - test_i18ngrep "Invalid whitespace option" err -' - write_reflog_expect () { if test $mode = --apply then diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index 6dabb05a2ad..ebcbd79ab8a 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -63,6 +63,5 @@ test_rebase_am_only () { } test_rebase_am_only --whitespace=fix -test_rebase_am_only -C4 test_done -- gitgitgadget