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

[PATCH 15/15] rebase: change the default backend from "am" to "merge"

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 20, 2019, 17:09 UTC
Message-ID
<999587933b2ce52db1687922b7d2b6a55049a7e0.1576861788.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.679.git.git.1576861788.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
The am-backend drops information and thus limits what we can do:
  * lack of full tree information from the original commits means we
    cannot do directory rename detection and warn users that they might
    want to move some of their new files that they placed in old
    directories to prevent their becoming orphaned.[1]
  * reduction in context from only having a few lines beyond those
    changed means that when context lines are non-unique we can apply
    patches incorrectly.[2]
  * lack of access to original commits means that conflict marker
    annotation has less information available.

Also, the merge/interactive backend have far more abilities, appear to currently have a slight performance advantage[3] and have room for more optimizations than the am backend[4] (and work is underway to take advantage of some of those possibilities).

[1] https://lore.kernel.org/git/xmqqh8jeh1id.fsf@gitster-ct.c.googlers.com/ [2] https://lore.kernel.org/git/CABPp-BGiu2nVMQY_t-rnFR5GQUz_ipyEE8oDocKeO+h+t4Mn4A@mail.gmail.com/ [3] https://public-inbox.org/git/CABPp-BF=ev03WgODk6TMQmuNoatg2kiEe5DR__gJ0OTVqHSnfQ@mail.gmail.com/ [4] https://lore.kernel.org/git/CABPp-BGh7yW69QwxQb13K0HM38NKmQif3A6C6UULEKYnkEJ5vA@mail.gmail.com/

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 Documentation/git-rebase.txt           |  2 +-
 builtin/rebase.c                       |  4 ++--
 t/t5520-pull.sh                        | 10 ++++++----
 t/t9106-git-svn-commit-diff-clobber.sh |  3 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index cf1ac2e359..e819889a31 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -309,7 +309,7 @@ See also INCOMPATIBLE OPTIONS below.
 --merge::
 	Use merging strategies to rebase.  When the recursive (default) merge
 	strategy is used, this allows rebase to be aware of renames on the
-	upstream side.
+	upstream side.  This is the default.
 +
 Note that a rebase merge works by replaying each commit from the working
 branch on top of the <upstream> branch.  Because of this, when a merge
diff --git a/builtin/rebase.c b/builtin/rebase.c
index eaa5eac59e..1c3d0b97d5 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -104,7 +104,7 @@ struct rebase_options {
 #define REBASE_OPTIONS_INIT {			  	\
 		.type = REBASE_UNSPECIFIED,	  	\
 		.empty = EMPTY_UNSPECIFIED,	  	\
-		.default_backend = "am",	  	\
+		.default_backend = "merge",	  	\
 		.flags = REBASE_NO_QUIET, 		\
 		.git_am_opts = ARGV_ARRAY_INIT,		\
 		.git_format_patch_opt = STRBUF_INIT	\
@@ -1949,7 +1949,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 
 	if (options.type == REBASE_UNSPECIFIED) {
 		if (!strcmp(options.default_backend, "merge"))
-			options.type = REBASE_MERGE;
+			imply_interactive(&options, "--merge");
 		else if (!strcmp(options.default_backend, "am"))
 			options.type = REBASE_AM;
 		else
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 3fff6a06fa..4f9e7f7ff6 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -340,7 +340,7 @@ test_expect_success '--rebase with conflicts shows advice' '
 	test_tick &&
 	git commit -m "Create conflict" seq.txt &&
 	test_must_fail git pull --rebase . seq 2>err >out &&
-	test_i18ngrep "Resolve all conflicts manually" out
+	test_i18ngrep "Resolve all conflicts manually" err
 '
 
 test_expect_success 'failed --rebase shows advice' '
@@ -354,7 +354,7 @@ test_expect_success 'failed --rebase shows advice' '
 	git checkout -f -b fails-to-rebase HEAD^ &&
 	test_commit v2-without-cr file "2" file2-lf &&
 	test_must_fail git pull --rebase . diverging 2>err >out &&
-	test_i18ngrep "Resolve all conflicts manually" out
+	test_i18ngrep "Resolve all conflicts manually" err
 '
 
 test_expect_success '--rebase fails with multiple branches' '
@@ -774,8 +774,10 @@ test_expect_success 'git pull --rebase does not reapply old patches' '
 	(
 		cd dst &&
 		test_must_fail git pull --rebase &&
-		find .git/rebase-apply -name "000*" >patches &&
-		test_line_count = 1 patches
+		cat .git/rebase-merge/done .git/rebase-merge/git-rebase-todo >work &&
+		grep -v -e \# -e ^$ work >patches &&
+		test_line_count = 1 patches &&
+		rm -f work
 	)
 '
 
diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index dbe8deac0d..aec45bca3b 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -92,7 +92,8 @@ test_expect_success 'multiple dcommit from git svn will not clobber svn' "
 
 
 test_expect_success 'check that rebase really failed' '
-	test -d .git/rebase-apply
+	git status >output &&
+	grep currently.rebasing output
 '
 
 test_expect_success 'resolve, continue the rebase and dcommit' "
-- 
gitgitgadget
Previous: Junio C HamanoNext: Elijah Newren via GitGitGadget
Message 25 of 161 in “rebase: make the default backend configurable”
  1. 00/15 rebase: make the default backend configurableElijah Newren via GitGitGadget, Dec 20, 2019
  2. 02/15 t3406: simplify an already simple testElijah Newren via GitGitGadget, Dec 20, 2019
  3. 03/15 rebase, sequencer: remove the broken GIT_QUIET handlingElijah Newren via GitGitGadget, Dec 20, 2019
  4. Junio C HamanoDec 20, 2019
  5. 01/15 rebase: extend the options for handling of empty commitsElijah Newren via GitGitGadget, Dec 20, 2019
  6. Junio C HamanoDec 20, 2019
  7. Elijah NewrenDec 21, 2019
  8. Elijah NewrenDec 21, 2019
  9. Junio C HamanoDec 21, 2019
  10. 06/15 t3432: make these tests work with either am or merge backendsElijah Newren via GitGitGadget, Dec 20, 2019
  11. Denton LiuDec 22, 2019
  12. Elijah NewrenDec 23, 2019
  13. 04/15 rebase: make sure to pass along the quiet flag to the sequencerElijah Newren via GitGitGadget, Dec 20, 2019
  14. 09/15 rebase: move incompatibility checks between backend options a bit earlierElijah Newren via GitGitGadget, Dec 20, 2019
  15. 07/15 rebase: allow more types of rebases to fast-forwardElijah Newren via GitGitGadget, Dec 20, 2019
  16. 08/15 git-rebase.txt: add more details about behavioral differences of backendsElijah Newren via GitGitGadget, Dec 20, 2019
  17. 13/15 rebase tests: repeat some tests using the merge backend instead of amElijah Newren via GitGitGadget, Dec 20, 2019
  18. 12/15 rebase tests: mark tests specific to the am-backend with --amElijah Newren via GitGitGadget, Dec 20, 2019
  19. 14/15 rebase: make the backend configurable via config settingElijah Newren via GitGitGadget, Dec 20, 2019
  20. 11/15 contrib: change the prompt for am-based rebasesElijah Newren via GitGitGadget, Dec 20, 2019
  21. SZEDER GáborDec 20, 2019
  22. Elijah NewrenDec 21, 2019
  23. 05/15 rebase: fix handling of restrict_revisionElijah Newren via GitGitGadget, Dec 20, 2019
  24. Junio C HamanoDec 20, 2019
  25. 15/15 rebase: change the default backend from "am" to "merge"Elijah Newren via GitGitGadget, Dec 20, 2019
  26. 10/15 rebase: add an --am optionElijah Newren via GitGitGadget, Dec 20, 2019
  27. Alban GruinDec 20, 2019
  28. Elijah NewrenDec 20, 2019
  29. 00/15 rebase: make the default backend configurableElijah Newren via GitGitGadget, Dec 23, 2019
  30. 02/15 t3406: simplify an already simple testElijah Newren via GitGitGadget, Dec 23, 2019
  31. 01/15 rebase: extend the options for handling of empty commitsElijah Newren via GitGitGadget, Dec 23, 2019
  32. 04/15 rebase: make sure to pass along the quiet flag to the sequencerElijah Newren via GitGitGadget, Dec 23, 2019
  33. 03/15 rebase, sequencer: remove the broken GIT_QUIET handlingElijah Newren via GitGitGadget, Dec 23, 2019
  34. 08/15 git-rebase.txt: add more details about behavioral differences of backendsElijah Newren via GitGitGadget, Dec 23, 2019
  35. 05/15 rebase: fix handling of restrict_revisionElijah Newren via GitGitGadget, Dec 23, 2019
  36. 07/15 rebase: allow more types of rebases to fast-forwardElijah Newren via GitGitGadget, Dec 23, 2019
  37. 06/15 t3432: make these tests work with either am or merge backendsElijah Newren via GitGitGadget, Dec 23, 2019
  38. 14/15 rebase: make the backend configurable via config settingElijah Newren via GitGitGadget, Dec 23, 2019
  39. 13/15 rebase tests: repeat some tests using the merge backend instead of amElijah Newren via GitGitGadget, Dec 23, 2019
  40. 12/15 rebase tests: mark tests specific to the am-backend with --amElijah Newren via GitGitGadget, Dec 23, 2019
  41. 15/15 rebase: change the default backend from "am" to "merge"Elijah Newren via GitGitGadget, Dec 23, 2019
  42. 09/15 rebase: move incompatibility checks between backend options a bit earlierElijah Newren via GitGitGadget, Dec 23, 2019
  43. 10/15 rebase: add an --am optionElijah Newren via GitGitGadget, Dec 23, 2019
  44. 11/15 contrib: change the prompt for interactive-based rebasesElijah Newren via GitGitGadget, Dec 23, 2019
  45. Denton LiuDec 23, 2019
  46. 00/15 rebase: make the default backend configurableElijah Newren via GitGitGadget, Dec 24, 2019
  47. 02/15 t3406: simplify an already simple testElijah Newren via GitGitGadget, Dec 24, 2019
  48. 03/15 rebase, sequencer: remove the broken GIT_QUIET handlingElijah Newren via GitGitGadget, Dec 24, 2019
  49. 01/15 rebase: extend the options for handling of empty commitsElijah Newren via GitGitGadget, Dec 24, 2019
  50. Phillip WoodJan 7, 2020
  51. Elijah NewrenJan 7, 2020
  52. Phillip WoodJan 8, 2020
  53. Johannes SchindelinJan 9, 2020
  54. 04/15 rebase: make sure to pass along the quiet flag to the sequencerElijah Newren via GitGitGadget, Dec 24, 2019
  55. 05/15 rebase: fix handling of restrict_revisionElijah Newren via GitGitGadget, Dec 24, 2019
  56. 07/15 rebase: allow more types of rebases to fast-forwardElijah Newren via GitGitGadget, Dec 24, 2019
  57. 06/15 t3432: make these tests work with either am or merge backendsElijah Newren via GitGitGadget, Dec 24, 2019
  58. 08/15 git-rebase.txt: add more details about behavioral differences of backendsElijah Newren via GitGitGadget, Dec 24, 2019
  59. 11/15 git-prompt: change the prompt for interactive-based rebasesElijah Newren via GitGitGadget, Dec 24, 2019
  60. 12/15 rebase tests: mark tests specific to the am-backend with --amElijah Newren via GitGitGadget, Dec 24, 2019
  61. 10/15 rebase: add an --am optionElijah Newren via GitGitGadget, Dec 24, 2019
  62. Phillip WoodJan 7, 2020
  63. Elijah NewrenJan 7, 2020
  64. Junio C HamanoJan 7, 2020
  65. Phillip WoodJan 8, 2020
  66. Junio C HamanoJan 8, 2020
  67. Phillip WoodJan 8, 2020
  68. 14/15 rebase: make the backend configurable via config settingElijah Newren via GitGitGadget, Dec 24, 2019
  69. 09/15 rebase: move incompatibility checks between backend options a bit earlierElijah Newren via GitGitGadget, Dec 24, 2019
  70. 15/15 rebase: change the default backend from "am" to "merge"Elijah Newren via GitGitGadget, Dec 24, 2019
  71. Jonathan NiederJan 10, 2020
  72. Elijah NewrenJan 11, 2020
  73. Phillip WoodJan 11, 2020
  74. Johannes SchindelinJan 12, 2020
  75. Elijah NewrenJan 16, 2020
  76. Jonathan NiederJan 16, 2020
  77. Jonathan NiederJan 16, 2020
  78. Elijah NewrenJan 16, 2020
  79. Jonathan NiederJan 16, 2020
  80. Elijah NewrenJan 16, 2020
  81. Jonathan NiederJan 16, 2020
  82. Elijah NewrenJan 16, 2020
  83. Junio C HamanoJan 16, 2020
  84. Elijah NewrenJan 17, 2020
  85. Elijah NewrenJan 16, 2020
  86. Junio C HamanoJan 16, 2020
  87. Johannes SchindelinJan 16, 2020
  88. Junio C HamanoJan 12, 2020
  89. Jonathan NiederJan 15, 2020
  90. Emily ShafferJan 15, 2020
  91. 13/15 rebase tests: repeat some tests using the merge backend instead of amElijah Newren via GitGitGadget, Dec 24, 2019
  92. 00/19 rebase: make the default backend configurableElijah Newren via GitGitGadget, Jan 16, 2020
  93. 01/19 git-rebase.txt: update description of --allow-empty-messageElijah Newren via GitGitGadget, Jan 16, 2020
  94. Phillip WoodFeb 9, 2020
  95. Elijah NewrenFeb 13, 2020
  96. 02/19 t3404: directly test the behavior of interestElijah Newren via GitGitGadget, Jan 16, 2020
  97. 03/19 rebase (interactive-backend): make --keep-empty the defaultElijah Newren via GitGitGadget, Jan 16, 2020
  98. Phillip WoodFeb 9, 2020
  99. Elijah NewrenFeb 13, 2020
  100. 04/19 rebase (interactive-backend): fix handling of commits that become emptyElijah Newren via GitGitGadget, Jan 16, 2020
  101. Phillip WoodFeb 10, 2020
  102. Elijah NewrenFeb 13, 2020
  103. Phillip WoodFeb 16, 2020
  104. 11/19 git-rebase.txt: add more details about behavioral differences of backendsElijah Newren via GitGitGadget, Jan 16, 2020
  105. 12/19 rebase: move incompatibility checks between backend options a bit earlierElijah Newren via GitGitGadget, Jan 16, 2020
  106. 14/19 git-prompt: change the prompt for interactive-based rebasesElijah Newren via GitGitGadget, Jan 16, 2020
  107. 07/19 rebase: make sure to pass along the quiet flag to the sequencerElijah Newren via GitGitGadget, Jan 16, 2020
  108. 06/19 rebase, sequencer: remove the broken GIT_QUIET handlingElijah Newren via GitGitGadget, Jan 16, 2020
  109. 10/19 rebase: allow more types of rebases to fast-forwardElijah Newren via GitGitGadget, Jan 16, 2020
  110. 09/19 t3432: make these tests work with either am or merge backendsElijah Newren via GitGitGadget, Jan 16, 2020
  111. 05/19 t3406: simplify an already simple testElijah Newren via GitGitGadget, Jan 16, 2020
  112. 08/19 rebase: fix handling of restrict_revisionElijah Newren via GitGitGadget, Jan 16, 2020
  113. 19/19 rebase: change the default backend from "am" to "merge"Elijah Newren via GitGitGadget, Jan 16, 2020
  114. 18/19 rebase: make the backend configurable via config settingElijah Newren via GitGitGadget, Jan 16, 2020
  115. 16/19 rebase tests: mark tests specific to the am-backend with --amElijah Newren via GitGitGadget, Jan 16, 2020
  116. 15/19 rebase: drop '-i' from the reflog for interactive-based rebasesElijah Newren via GitGitGadget, Jan 16, 2020
  117. 17/19 rebase tests: repeat some tests using the merge backend instead of amElijah Newren via GitGitGadget, Jan 16, 2020
  118. 13/19 rebase: add an --am optionElijah Newren via GitGitGadget, Jan 16, 2020
  119. Phillip WoodJan 17, 2020
  120. Junio C HamanoFeb 5, 2020
  121. Elijah NewrenFeb 5, 2020
  122. 00/20 rebase: make the default backend configurable and change the defaultElijah Newren via GitGitGadget, Feb 15, 2020
  123. 01/20 git-rebase.txt: update description of --allow-empty-messageElijah Newren via GitGitGadget, Feb 15, 2020
  124. 02/20 t3404: directly test the behavior of interestElijah Newren via GitGitGadget, Feb 15, 2020
  125. 05/20 t3406: simplify an already simple testElijah Newren via GitGitGadget, Feb 15, 2020
  126. 06/20 rebase, sequencer: remove the broken GIT_QUIET handlingElijah Newren via GitGitGadget, Feb 15, 2020
  127. 09/20 t3432: make these tests work with either am or merge backendsElijah Newren via GitGitGadget, Feb 15, 2020
  128. 03/20 rebase (interactive-backend): make --keep-empty the defaultElijah Newren via GitGitGadget, Feb 15, 2020
  129. 08/20 rebase: fix handling of restrict_revisionElijah Newren via GitGitGadget, Feb 15, 2020
  130. 04/20 rebase (interactive-backend): fix handling of commits that become emptyElijah Newren via GitGitGadget, Feb 15, 2020
  131. 12/20 rebase: move incompatibility checks between backend options a bit earlierElijah Newren via GitGitGadget, Feb 15, 2020
  132. 10/20 rebase: allow more types of rebases to fast-forwardElijah Newren via GitGitGadget, Feb 15, 2020
  133. 19/20 rebase: change the default backend from "am" to "merge"Elijah Newren via GitGitGadget, Feb 15, 2020
  134. 18/20 rebase: make the backend configurable via config settingElijah Newren via GitGitGadget, Feb 15, 2020
  135. 17/20 rebase tests: repeat some tests using the merge backend instead of amElijah Newren via GitGitGadget, Feb 15, 2020
  136. 16/20 rebase tests: mark tests specific to the am-backend with --amElijah Newren via GitGitGadget, Feb 15, 2020
  137. 20/20 rebase: rename the two primary rebase backendsElijah Newren via GitGitGadget, Feb 15, 2020
  138. Emily ShafferMar 12, 2020
  139. Elijah NewrenMar 12, 2020
  140. Jonathan NiederMar 12, 2020
  141. Elijah NewrenMar 12, 2020
  142. Jonathan NiederMar 12, 2020
  143. Elijah NewrenMar 12, 2020
  144. Jonathan NiederMar 17, 2020
  145. Elijah NewrenMar 17, 2020
  146. Junio C HamanoMar 12, 2020
  147. Junio C HamanoMar 12, 2020
  148. Jonathan NiederMar 12, 2020
  149. Junio C HamanoMar 12, 2020
  150. Elijah NewrenMar 12, 2020
  151. Jeff KingMar 12, 2020
  152. Junio C HamanoMar 12, 2020
  153. Elijah NewrenMar 12, 2020
  154. Junio C HamanoMar 13, 2020
  155. Jonathan NiederMar 12, 2020
  156. 07/20 rebase: make sure to pass along the quiet flag to the sequencerElijah Newren via GitGitGadget, Feb 15, 2020
  157. 15/20 rebase: drop '-i' from the reflog for interactive-based rebasesElijah Newren via GitGitGadget, Feb 15, 2020
  158. 14/20 git-prompt: change the prompt for interactive-based rebasesElijah Newren via GitGitGadget, Feb 15, 2020
  159. 13/20 rebase: add an --am optionElijah Newren via GitGitGadget, Feb 15, 2020
  160. 11/20 git-rebase.txt: add more details about behavioral differences of backendsElijah Newren via GitGitGadget, Feb 15, 2020
  161. Phillip WoodFeb 16, 2020

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.