git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 00/11] Drop support for git rebase --preserve-merges

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Sep 7, 2021, 21:05 UTC
Message-ID
<pull.195.v3.git.1631048712.gitgitgadget@gmail.com>
In-Reply-To
<pull.195.v2.git.1630497435.gitgitgadget@gmail.com>

In 427c3bd28ab (rebase: deprecate --preserve-merges, 2019-03-11) (which was included in v2.22.0), we officially deprecated the --preserve-merges backend. Over two years later, it is time to drop that backend, and here is a patch series that does just that.

Changes since v2:
 * Removed the no-longer-needed script_snippet variable
 * Enhanced the commit message of the git svn patch to clarify that the
   deprecation happened only in v2.25 there
 * Adjusted code comments that still talked about the removed option
 * Removed some no-longer-needed ACTION_* enum values
 * We now also drop check_todo_list_from_file() because it is no longer
   needed
 * The todo_list_add_exec_commands() function is now scoped to the file
   (because there are no longer any outside users)
 * When users still use the options, they are no longer met by Git's blank
   stares, but by a helpful error message suggesting to use --rebase-merges
   instead
Changes since v1:
 * Rebased onto v2.33.0
Johannes Schindelin (11):
  t5520: do not use `pull.rebase=preserve`
  remote: warn about unhandled branch.<name>.rebase values
  tests: stop testing `git rebase --preserve-merges`
  pull: remove support for `--rebase=preserve`
  rebase: drop support for `--preserve-merges`
  git-svn: drop support for `--preserve-merges`
  rebase: drop the internal `rebase--interactive` command
  rebase: remove obsolete code comment
  rebase: stop mentioning the -p option in comments
  rebase: remove a no-longer-used function
  sequencer: restrict scope of a formerly public function
 .github/workflows/main.yml                |    1 -
 .gitignore                                |    1 -
 Documentation/config/branch.txt           |    4 -
 Documentation/config/pull.txt             |    4 -
 Documentation/git-pull.txt                |    6 +-
 Documentation/git-rebase.txt              |   51 -
 Documentation/git-svn.txt                 |    1 -
 Makefile                                  |    2 -
 builtin/pull.c                            |    9 +-
 builtin/rebase.c                          |  335 +------
 builtin/remote.c                          |    3 +
 contrib/completion/git-completion.bash    |    2 +-
 git-rebase--preserve-merges.sh            | 1057 ---------------------
 git-svn.perl                              |    1 -
 git.c                                     |    1 -
 rebase-interactive.c                      |   29 -
 rebase-interactive.h                      |    2 -
 rebase.c                                  |    5 +-
 rebase.h                                  |    1 -
 sequencer.c                               |    4 +-
 sequencer.h                               |    2 -
 t/t3404-rebase-interactive.sh             |   76 --
 t/t3408-rebase-multi-line.sh              |   10 -
 t/t3409-rebase-preserve-merges.sh         |  130 ---
 t/t3410-rebase-preserve-dropped-merges.sh |   90 --
 t/t3411-rebase-preserve-around-merges.sh  |   80 --
 t/t3412-rebase-root.sh                    |   37 -
 t/t3414-rebase-preserve-onto.sh           |   85 --
 t/t3418-rebase-continue.sh                |   15 -
 t/t3421-rebase-topology-linear.sh         |   19 -
 t/t3422-rebase-incompatible-options.sh    |   11 -
 t/t3425-rebase-topology-merges.sh         |  151 ---
 t/t3427-rebase-subtree.sh                 |   26 +-
 t/t5520-pull.sh                           |   24 +-
 t/t7505-prepare-commit-msg-hook.sh        |    1 -
 t/t7517-per-repo-email.sh                 |   13 -
 t/test-lib.sh                             |    4 -
 37 files changed, 33 insertions(+), 2260 deletions(-)
 delete mode 100644 git-rebase--preserve-merges.sh
 delete mode 100755 t/t3409-rebase-preserve-merges.sh
 delete mode 100755 t/t3410-rebase-preserve-dropped-merges.sh
 delete mode 100755 t/t3411-rebase-preserve-around-merges.sh
 delete mode 100755 t/t3414-rebase-preserve-onto.sh
base-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-195%2Fdscho%2Fdrop-rebase-p-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-195/dscho/drop-rebase-p-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/195
Range-diff vs v2:
  1:  8da29d539fc =  1:  8da29d539fc t5520: do not use `pull.rebase=preserve`
  2:  acda0f59947 =  2:  acda0f59947 remote: warn about unhandled branch.<name>.rebase values
  3:  cdb9fae4b93 !  3:  e4b683f0cd6 tests: stop testing `git rebase --preserve-merges`
     @@ t/t3425-rebase-topology-merges.sh: test_run_rebase success 'd n o e' --apply
       test_done
      
       ## t/t3427-rebase-subtree.sh ##
     +@@ t/t3427-rebase-subtree.sh: commit_message() {
     + # where the root commit adds three files: topic_1.t, topic_2.t and topic_3.t.
     + #
     + # This commit history is then rebased onto `topic_3` with the
     +-# `-Xsubtree=files_subtree` option in three different ways:
     ++# `-Xsubtree=files_subtree` option in two different ways:
     + #
     +-# 1. using `--preserve-merges`
     +-# 2. using `--preserve-merges` and --keep-empty
     +-# 3. without specifying a rebase backend
     ++# 1. without specifying a rebase backend
     ++# 2. using the `--rebase-merges` backend
     + 
     + test_expect_success 'setup' '
     + 	test_commit README &&
      @@ t/t3427-rebase-subtree.sh: test_expect_success 'setup' '
       	git commit -m "Empty commit" --allow-empty
       '
  4:  b493046134d !  4:  6e45e90abe5 pull: remove support for `--rebase=preserve`
     @@ Commit message
          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>
      
       ## Documentation/config/branch.txt ##
     @@ contrib/completion/git-completion.bash: __git_complete_config_variable_value ()
       	remote.pushdefault)
      
       ## rebase.c ##
     +@@
     + #include "rebase.h"
     + #include "config.h"
     ++#include "gettext.h"
     + 
     + /*
     +  * Parses textual value for pull.rebase, branch.<name>.rebase, etc.
      @@ rebase.c: enum rebase_type rebase_parse_value(const char *value)
       		return REBASE_FALSE;
       	else if (v > 0)
     @@ rebase.c: enum rebase_type rebase_parse_value(const char *value)
       	else if (!strcmp(value, "merges") || !strcmp(value, "m"))
       		return REBASE_MERGES;
       	else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
     + 		return REBASE_INTERACTIVE;
     ++	else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
     ++		error(_("%s: 'preserve' superseded by 'merges'"), value);
     + 	/*
     + 	 * Please update _git_config() in git-completion.bash when you
     + 	 * add new rebase modes.
      
       ## rebase.h ##
      @@ rebase.h: enum rebase_type {
  5:  eb738b1bf05 !  5:  2d7a4a2c564 rebase: drop support for `--preserve-merges`
     @@ Commit message
          This option was deprecated in favor of `--rebase-merges` some time ago,
          and now we retire it.
      
     +    To assist users to transition away, we do not _actually_ remove the
     +    option, but now we no longer implement the functionality. Instead, we
     +    offer a helpful error message suggesting which option to use.
     +
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
       ## .gitignore ##
     @@ builtin/rebase.c: static int run_am(struct rebase_options *opts)
       {
      -	const char *argv[] = { NULL, NULL };
      -	struct strbuf script_snippet = STRBUF_INIT, buf = STRBUF_INIT;
     -+	struct strbuf script_snippet = STRBUF_INIT;
       	int status;
      -	const char *backend, *backend_func;
       
     @@ builtin/rebase.c: static int run_specific_rebase(struct rebase_options *opts, en
       		BUG("Unhandled rebase type %d", opts->type);
      -		break;
      -	}
     - 
     +-
      -	strbuf_addf(&script_snippet,
      -		    ". git-sh-setup && . %s && %s", backend, backend_func);
      -	argv[0] = script_snippet.buf;
     --
     + 
      -	status = run_command_v_opt(argv, RUN_USING_SHELL);
      -finished_rebase:
       	if (opts->dont_finish_rebase)
       		; /* do nothing */
       	else if (opts->type == REBASE_MERGE)
     +@@ builtin/rebase.c: finished_rebase:
     + 		die("Nothing to do");
     + 	}
     + 
     +-	strbuf_release(&script_snippet);
     +-
     + 	return status ? -1 : 0;
     + }
     + 
     +@@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix)
     + 	char *squash_onto_name = NULL;
     + 	int reschedule_failed_exec = -1;
     + 	int allow_preemptive_ff = 1;
     ++	int preserve_merges_selected = 0;
     + 	struct option builtin_rebase_options[] = {
     + 		OPT_STRING(0, "onto", &options.onto_name,
     + 			   N_("revision"),
      @@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix)
       			N_("let the user edit the list of commits to rebase"),
       			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
       			parse_opt_interactive),
      -		OPT_SET_INT_F('p', "preserve-merges", &options.type,
     --			      N_("(DEPRECATED) try to recreate merges instead of "
     --				 "ignoring them"),
     ++		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
     + 			      N_("(DEPRECATED) try to recreate merges instead of "
     + 				 "ignoring them"),
      -			      REBASE_PRESERVE_MERGES, PARSE_OPT_HIDDEN),
     ++			      1, PARSE_OPT_HIDDEN),
       		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
       		OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}",
       			       N_("how to handle commits that become empty"),
     @@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix
       		} else {
       			strbuf_reset(&buf);
       			strbuf_addf(&buf, "%s/interactive", merge_dir());
     +@@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix)
     + 			     builtin_rebase_options,
     + 			     builtin_rebase_usage, 0);
     + 
     ++	if (preserve_merges_selected)
     ++		die(_("--preserve-merges was replaced by --rebase-merges"));
     ++
     + 	if (action != ACTION_NONE && total_argc != 2) {
     + 		usage_with_options(builtin_rebase_usage,
     + 				   builtin_rebase_options);
      @@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix)
       		usage_with_options(builtin_rebase_usage,
       				   builtin_rebase_options);
  6:  a987e9439af !  6:  913647d8e76 git-svn: drop support for `--preserve-merges`
     @@ Commit message
          We already passed the `--rebase-merges` option to `git rebase` instead,
          now we make this move permanent.
      
     +    As pointed out by Ævar Arnfjörð Bjarmason, in contrast to the
     +    deprecation of `git rebase`'s `--preserve-merges` backend, `git svn`
     +    only deprecated this option in v2.25.0 (because this developer missed
     +    `git svn`'s use of that backend when deprecating the rebase backend
     +    running up to Git v2.22).
     +
     +    Still, v2.25.0 has been released on January 13th, 2020. In other words,
     +    `git svn` deprecated this option over one and a half years ago, _and_
     +    has been redirecting to the `--rebase-merges` option during all that
     +    time (read: `git svn rebase --preserve-merges` didn't do _precisely_
     +    what the user asked, since v2.25.0, anyway, it fell back to pretending
     +    that the user asked for `git svn rebase --rebase-merges` instead).
     +
     +    It is time to act on that deprecation and remove that option after all.
     +
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
       ## Documentation/git-svn.txt ##
  7:  4492cca369c !  7:  b5a16e205e6 rebase: drop the internal `rebase--interactive` command
     @@ Commit message
          It was only used by the `--preserve-merges` backend, which we just
          removed.
      
     +    Helped-by: Alban Gruin <alban.gruin@gmail.com>
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
       ## builtin/rebase.c ##
     +@@ builtin/rebase.c: enum action {
     + 	ACTION_ABORT,
     + 	ACTION_QUIT,
     + 	ACTION_EDIT_TODO,
     +-	ACTION_SHOW_CURRENT_PATCH,
     +-	ACTION_SHORTEN_OIDS,
     +-	ACTION_EXPAND_OIDS,
     +-	ACTION_CHECK_TODO_LIST,
     +-	ACTION_REARRANGE_SQUASH,
     +-	ACTION_ADD_EXEC
     ++	ACTION_SHOW_CURRENT_PATCH
     + };
     + 
     + static const char *action_names[] = { "undefined",
      @@ builtin/rebase.c: static const char *action_names[] = { "undefined",
       				      "edit_todo",
       				      "show_current_patch" };
     @@ builtin/rebase.c: static const char *action_names[] = { "undefined",
       {
       	const char *todo_file = rebase_path_todo();
      @@ builtin/rebase.c: static int run_sequencer_rebase(struct rebase_options *opts,
     + 	flags |= opts->rebase_merges ? TODO_LIST_REBASE_MERGES : 0;
     + 	flags |= opts->rebase_cousins > 0 ? TODO_LIST_REBASE_COUSINS : 0;
     + 	flags |= opts->root_with_onto ? TODO_LIST_ROOT_WITH_ONTO : 0;
     +-	flags |= command == ACTION_SHORTEN_OIDS ? TODO_LIST_SHORTEN_IDS : 0;
     + 	flags |= opts->reapply_cherry_picks ? TODO_LIST_REAPPLY_CHERRY_PICKS : 0;
     + 
     + 	switch (command) {
     +@@ builtin/rebase.c: static int run_sequencer_rebase(struct rebase_options *opts,
       
       		break;
       	}
  -:  ----------- >  8:  d23f245b684 rebase: remove obsolete code comment
  -:  ----------- >  9:  6905c8746ba rebase: stop mentioning the -p option in comments
  -:  ----------- > 10:  5bb04ea3f6c rebase: remove a no-longer-used function
  -:  ----------- > 11:  aae9323b25f sequencer: restrict scope of a formerly public function
-- 
gitgitgadget
Previous: Johannes SchindelinNext: Johannes Schindelin via GitGitGadget
Message 62 of 78 in “Drop support for git rebase --preserve-merges”
  1. 0/8 Drop support for git rebase --preserve-mergesJohannes Schindelin via GitGitGadget, Nov 23, 2019
  2. 1/8 t5520: do not use `pull.rebase=preserve`Johannes Schindelin via GitGitGadget, Nov 23, 2019
  3. 2/8 remote: warn about unhandled branch.<name>.rebase valuesJohannes Schindelin via GitGitGadget, Nov 23, 2019
  4. 4/8 pull: remove support for `--rebase=preserve`Johannes Schindelin via GitGitGadget, Nov 23, 2019
  5. 6/8 git-svn: drop support for `--preserve-merges`Johannes Schindelin via GitGitGadget, Nov 23, 2019
  6. Eric WongNov 23, 2019
  7. Johannes SchindelinNov 24, 2019
  8. Eric WongNov 25, 2019
  9. 3/8 tests: stop testing `git rebase --preserve-merges`Johannes Schindelin via GitGitGadget, Nov 23, 2019
  10. 8/8 remote: no longer claim that branch.*.rebase=preserve is a thingJohannes Schindelin via GitGitGadget, Nov 23, 2019
  11. 7/8 rebase: drop the internal `rebase--interactive` commandJohannes Schindelin via GitGitGadget, Nov 23, 2019
  12. 5/8 rebase: drop support for `--preserve-merges`Johannes Schindelin via GitGitGadget, Nov 23, 2019
  13. 0/7 Drop support for git rebase --preserve-mergesJohannes Schindelin via GitGitGadget, Sep 1, 2021
  14. 1/7 t5520: do not use `pull.rebase=preserve`Johannes Schindelin via GitGitGadget, Sep 1, 2021
  15. 2/7 remote: warn about unhandled branch.<name>.rebase valuesJohannes Schindelin via GitGitGadget, Sep 1, 2021
  16. 4/7 pull: remove support for `--rebase=preserve`Johannes Schindelin via GitGitGadget, Sep 1, 2021
  17. 3/7 tests: stop testing `git rebase --preserve-merges`Johannes Schindelin via GitGitGadget, Sep 1, 2021
  18. Ævar Arnfjörð BjarmasonSep 1, 2021
  19. 6/7 git-svn: drop support for `--preserve-merges`Johannes Schindelin via GitGitGadget, Sep 1, 2021
  20. Ævar Arnfjörð BjarmasonSep 1, 2021
  21. Johannes SchindelinSep 2, 2021
  22. Johannes SchindelinSep 2, 2021
  23. 5/7 rebase: drop support for `--preserve-merges`Johannes Schindelin via GitGitGadget, Sep 1, 2021
  24. Ævar Arnfjörð BjarmasonSep 1, 2021
  25. Johannes SchindelinSep 2, 2021
  26. Ævar Arnfjörð BjarmasonSep 2, 2021
  27. Ævar Arnfjörð BjarmasonSep 1, 2021
  28. Johannes SchindelinSep 2, 2021
  29. Ævar Arnfjörð BjarmasonSep 2, 2021
  30. Ævar Arnfjörð BjarmasonSep 2, 2021
  31. Ævar Arnfjörð BjarmasonSep 2, 2021
  32. Ævar Arnfjörð BjarmasonSep 2, 2021
  33. Ævar Arnfjörð BjarmasonSep 2, 2021
  34. Johannes SchindelinSep 4, 2021
  35. Ævar Arnfjörð BjarmasonSep 5, 2021
  36. Junio C HamanoSep 5, 2021
  37. Phillip WoodSep 6, 2021
  38. Johannes SchindelinSep 7, 2021
  39. Phillip WoodSep 7, 2021
  40. Johannes SchindelinSep 7, 2021
  41. 7/7 rebase: drop the internal `rebase--interactive` commandJohannes Schindelin via GitGitGadget, Sep 1, 2021
  42. Phillip WoodSep 6, 2021
  43. Johannes SchindelinSep 7, 2021
  44. Ævar Arnfjörð BjarmasonSep 1, 2021
  45. Johannes SchindelinSep 2, 2021
  46. Ævar Arnfjörð BjarmasonSep 2, 2021
  47. Junio C HamanoSep 1, 2021
  48. Johannes SchindelinSep 2, 2021
  49. Johannes SixtSep 2, 2021
  50. Johannes SchindelinSep 7, 2021
  51. Elijah NewrenSep 7, 2021
  52. Johannes SchindelinSep 10, 2021
  53. Elijah NewrenSep 10, 2021
  54. merge-ort and --rebase-merges, was Re: [PATCH v2 0/7] Drop support for git rebase --preserve-mergesJohannes Schindelin, Sep 13, 2021
  55. Elijah NewrenSep 13, 2021
  56. Ævar Arnfjörð BjarmasonSep 6, 2021
  57. Junio C HamanoSep 7, 2021
  58. Ævar Arnfjörð BjarmasonSep 7, 2021
  59. Alban GruinSep 4, 2021
  60. Phillip WoodSep 6, 2021
  61. Johannes SchindelinSep 7, 2021
  62. 00/11 Drop support for git rebase --preserve-mergesJohannes Schindelin via GitGitGadget, Sep 7, 2021
  63. 01/11 t5520: do not use `pull.rebase=preserve`Johannes Schindelin via GitGitGadget, Sep 7, 2021
  64. 02/11 remote: warn about unhandled branch.<name>.rebase valuesJohannes Schindelin via GitGitGadget, Sep 7, 2021
  65. 03/11 tests: stop testing `git rebase --preserve-merges`Johannes Schindelin via GitGitGadget, Sep 7, 2021
  66. 04/11 pull: remove support for `--rebase=preserve`Johannes Schindelin via GitGitGadget, Sep 7, 2021
  67. 06/11 git-svn: drop support for `--preserve-merges`Johannes Schindelin via GitGitGadget, Sep 7, 2021
  68. 05/11 rebase: drop support for `--preserve-merges`Johannes Schindelin via GitGitGadget, Sep 7, 2021
  69. Ævar Arnfjörð BjarmasonSep 10, 2021
  70. re-mentioning --preserve-merges in the docs (was: [PATCH v3 05/11] rebase: drop support for `--preserve-merges`)Ævar Arnfjörð Bjarmason, Jul 21, 2022
  71. Junio C HamanoJul 21, 2022
  72. Johannes SchindelinJul 29, 2022
  73. 07/11 rebase: drop the internal `rebase--interactive` commandJohannes Schindelin via GitGitGadget, Sep 7, 2021
  74. 08/11 rebase: remove obsolete code commentJohannes Schindelin via GitGitGadget, Sep 7, 2021
  75. 09/11 rebase: stop mentioning the -p option in commentsJohannes Schindelin via GitGitGadget, Sep 7, 2021
  76. 10/11 rebase: remove a no-longer-used functionJohannes Schindelin via GitGitGadget, Sep 7, 2021
  77. 11/11 sequencer: restrict scope of a formerly public functionJohannes Schindelin via GitGitGadget, Sep 7, 2021
  78. Ævar Arnfjörð BjarmasonSep 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.