Skip to content

Commit 52f1e82

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Reviewed-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aa4df10 commit 52f1e82

File tree

7 files changed

+8
-23
lines changed

7 files changed

+8
-23
lines changed

Documentation/config/branch.txt

-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ When `merges` (or just 'm'), pass the `--rebase-merges` option to 'git rebase'
8585
so that the local merge commits are included in the rebase (see
8686
linkgit:git-rebase[1] for details).
8787
+
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-
+
9288
When the value is `interactive` (or just 'i'), the rebase is run in interactive
9389
mode.
9490
+

Documentation/config/pull.txt

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ When `merges` (or just 'm'), pass the `--rebase-merges` option to 'git rebase'
1818
so that the local merge commits are included in the rebase (see
1919
linkgit:git-rebase[1] for details).
2020
+
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-
+
2521
When the value is `interactive` (or just 'i'), the rebase is run in interactive
2622
mode.
2723
+

Documentation/git-pull.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Options related to merging
102102
include::merge-options.txt[]
103103

104104
-r::
105-
--rebase[=false|true|merges|preserve|interactive]::
105+
--rebase[=false|true|merges|interactive]::
106106
When true, rebase the current branch on top of the upstream
107107
branch after fetching. If there is a remote-tracking branch
108108
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
113113
the local merge commits are included in the rebase (see
114114
linkgit:git-rebase[1] for details).
115115
+
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-
+
120116
When false, merge the upstream branch into the current branch.
121117
+
122118
When `interactive`, enable the interactive mode of rebase.

builtin/pull.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
/**
3131
* Parses the value of --rebase. If value is a false value, returns
3232
* 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.
3635
*/
3736
static enum rebase_type parse_config_rebase(const char *key, const char *value,
3837
int fatal)
@@ -126,7 +125,7 @@ static struct option pull_options[] = {
126125
/* Options passed to git-merge or git-rebase */
127126
OPT_GROUP(N_("Options related to merging")),
128127
OPT_CALLBACK_F('r', "rebase", &opt_rebase,
129-
"(false|true|merges|preserve|interactive)",
128+
"(false|true|merges|interactive)",
130129
N_("incorporate changes by rebasing rather than merging"),
131130
PARSE_OPT_OPTARG, parse_opt_rebase),
132131
OPT_PASSTHRU('n', NULL, &opt_diffstat, NULL,
@@ -883,8 +882,6 @@ static int run_rebase(const struct object_id *newbase,
883882
/* Options passed to git-rebase */
884883
if (opt_rebase == REBASE_MERGES)
885884
strvec_push(&args, "--rebase-merges");
886-
else if (opt_rebase == REBASE_PRESERVE)
887-
strvec_push(&args, "--preserve-merges");
888885
else if (opt_rebase == REBASE_INTERACTIVE)
889886
strvec_push(&args, "--interactive");
890887
if (opt_diffstat)

contrib/completion/git-completion.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,7 @@ __git_complete_config_variable_value ()
25432543
return
25442544
;;
25452545
branch.*.rebase)
2546-
__gitcomp "false true merges preserve interactive" "" "$cur_"
2546+
__gitcomp "false true merges interactive" "" "$cur_"
25472547
return
25482548
;;
25492549
remote.pushdefault)

rebase.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "rebase.h"
22
#include "config.h"
3+
#include "gettext.h"
34

45
/*
56
* Parses textual value for pull.rebase, branch.<name>.rebase, etc.
@@ -20,12 +21,12 @@ enum rebase_type rebase_parse_value(const char *value)
2021
return REBASE_FALSE;
2122
else if (v > 0)
2223
return REBASE_TRUE;
23-
else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
24-
return REBASE_PRESERVE;
2524
else if (!strcmp(value, "merges") || !strcmp(value, "m"))
2625
return REBASE_MERGES;
2726
else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
2827
return REBASE_INTERACTIVE;
28+
else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
29+
error(_("%s: 'preserve' superseded by 'merges'"), value);
2930
/*
3031
* Please update _git_config() in git-completion.bash when you
3132
* add new rebase modes.

rebase.h

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ enum rebase_type {
55
REBASE_INVALID = -1,
66
REBASE_FALSE = 0,
77
REBASE_TRUE,
8-
REBASE_PRESERVE,
98
REBASE_MERGES,
109
REBASE_INTERACTIVE
1110
};

0 commit comments

Comments
 (0)