pull: remove support for `--rebase=preserve`

In preparation for `git-rebase--preserve-merges.sh` entering its after life, we remove this (deprecated) option that would still rely on it. To help users transition who still did not receive the memo about the deprecation, we offer a helpful error message instead of throwing our hands in the air and saying that we don't know that option, never heard of it. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Sep 7, 2021 at 21:05 UTC 52f1e82178e75bdf876799770922bc34fdf6fae4
7 files changed +8 -23
Documentation/config/branch.txt
-4
@@ -85,10 +85,6 @@ When `merges` (or just 'm'), pass the `--rebase-merges` option to 'git rebase'
85 so that the local merge commits are included in the rebase (see
86 linkgit:git-rebase[1] for details).
87 +
88 -When `preserve` (or just 'p', deprecated in favor of `merges`), also pass
89 -`--preserve-merges` along to 'git rebase' so that locally committed merge
90 -commits will not be flattened by running 'git pull'.
91 -+
88 When the value is `interactive` (or just 'i'), the rebase is run in interactive
89 mode.
90 +
Documentation/config/pull.txt
-4
@@ -18,10 +18,6 @@ When `merges` (or just 'm'), pass the `--rebase-merges` option to 'git rebase'
18 so that the local merge commits are included in the rebase (see
19 linkgit:git-rebase[1] for details).
20 +
21 -When `preserve` (or just 'p', deprecated in favor of `merges`), also pass
22 -`--preserve-merges` along to 'git rebase' so that locally committed merge
23 -commits will not be flattened by running 'git pull'.
24 -+
21 When the value is `interactive` (or just 'i'), the rebase is run in interactive
22 mode.
23 +
Documentation/git-pull.txt
+1 -5
@@ -102,7 +102,7 @@ Options related to merging
102 include::merge-options.txt[]
103
104 -r::
105 ---rebase[=false|true|merges|preserve|interactive]::
105 +--rebase[=false|true|merges|interactive]::
106 When true, rebase the current branch on top of the upstream
107 branch after fetching. If there is a remote-tracking branch
108 corresponding to the upstream branch and the upstream branch
@@ -113,10 +113,6 @@ When set to `merges`, rebase using `git rebase --rebase-merges` so that
113 the local merge commits are included in the rebase (see
114 linkgit:git-rebase[1] for details).
115 +
116 -When set to `preserve` (deprecated in favor of `merges`), rebase with the
117 -`--preserve-merges` option passed to `git rebase` so that locally created
118 -merge commits will not be flattened.
119 -+
116 When false, merge the upstream branch into the current branch.
117 +
118 When `interactive`, enable the interactive mode of rebase.
builtin/pull.c
+3 -6
@@ -30,9 +30,8 @@
30 /**
31 * Parses the value of --rebase. If value is a false value, returns
32 * REBASE_FALSE. If value is a true value, returns REBASE_TRUE. If value is
33 - * "merges", returns REBASE_MERGES. If value is "preserve", returns
34 - * REBASE_PRESERVE. If value is a invalid value, dies with a fatal error if
35 - * fatal is true, otherwise returns REBASE_INVALID.
33 + * "merges", returns REBASE_MERGES. If value is a invalid value, dies with
34 + * a fatal error if fatal is true, otherwise returns REBASE_INVALID.
35 */
36 static enum rebase_type parse_config_rebase(const char *key, const char *value,
37 int fatal)
@@ -126,7 +125,7 @@ static struct option pull_options[] = {
125 /* Options passed to git-merge or git-rebase */
126 OPT_GROUP(N_("Options related to merging")),
127 OPT_CALLBACK_F('r', "rebase", &opt_rebase,
129 - "(false|true|merges|preserve|interactive)",
128 + "(false|true|merges|interactive)",
129 N_("incorporate changes by rebasing rather than merging"),
130 PARSE_OPT_OPTARG, parse_opt_rebase),
131 OPT_PASSTHRU('n', NULL, &opt_diffstat, NULL,
@@ -883,8 +882,6 @@ static int run_rebase(const struct object_id *newbase,
882 /* Options passed to git-rebase */
883 if (opt_rebase == REBASE_MERGES)
884 strvec_push(&args, "--rebase-merges");
886 - else if (opt_rebase == REBASE_PRESERVE)
887 - strvec_push(&args, "--preserve-merges");
885 else if (opt_rebase == REBASE_INTERACTIVE)
886 strvec_push(&args, "--interactive");
887 if (opt_diffstat)
contrib/completion/git-completion.bash
+1 -1
@@ -2543,7 +2543,7 @@ __git_complete_config_variable_value ()
2543 return
2544 ;;
2545 branch.*.rebase)
2546 - __gitcomp "false true merges preserve interactive" "" "$cur_"
2546 + __gitcomp "false true merges interactive" "" "$cur_"
2547 return
2548 ;;
2549 remote.pushdefault)
rebase.c
+3 -2
@@ -1,5 +1,6 @@
1 #include "rebase.h"
2 #include "config.h"
3 +#include "gettext.h"
4
5 /*
6 * Parses textual value for pull.rebase, branch.<name>.rebase, etc.
@@ -20,12 +21,12 @@ enum rebase_type rebase_parse_value(const char *value)
21 return REBASE_FALSE;
22 else if (v > 0)
23 return REBASE_TRUE;
23 - else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
24 - return REBASE_PRESERVE;
24 else if (!strcmp(value, "merges") || !strcmp(value, "m"))
25 return REBASE_MERGES;
26 else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
27 return REBASE_INTERACTIVE;
28 + else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
29 + error(_("%s: 'preserve' superseded by 'merges'"), value);
30 /*
31 * Please update _git_config() in git-completion.bash when you
32 * add new rebase modes.
rebase.h
-1
@@ -5,7 +5,6 @@ enum rebase_type {
5 REBASE_INVALID = -1,
6 REBASE_FALSE = 0,
7 REBASE_TRUE,
8 - REBASE_PRESERVE,
8 REBASE_MERGES,
9 REBASE_INTERACTIVE
10 };