git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>, Elijah Newren <newren@gmail.com>
Subject: [PATCH 5/8] merge, sequencer: switch recursive merges over to ort
Date: Mon, 31 Mar 2025 15:51:16 +0000	[thread overview]
Message-ID: <91398ffd1e12e42fe9c9233a6ec14c448dea79ae.1743436280.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1898.git.1743436279.gitgitgadget@gmail.com>

From: Elijah Newren <newren@gmail.com>

More precisely, replace calls to merge_recursive() with
merge_ort_recursive().

Also change t7615 to quit calling out recursive; it is not needed
anymore, and we are in fact using ort now.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 builtin/merge.c                            |  9 ++-------
 sequencer.c                                | 23 ++++++++--------------
 t/t7615-diff-algo-with-mergy-operations.sh |  2 --
 3 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/builtin/merge.c b/builtin/merge.c
index ba9faf126aa..c0bbdab7104 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -39,7 +39,6 @@
 #include "rerere.h"
 #include "help.h"
 #include "merge.h"
-#include "merge-recursive.h"
 #include "merge-ort-wrappers.h"
 #include "resolve-undo.h"
 #include "remote.h"
@@ -750,12 +749,8 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
 
 		repo_hold_locked_index(the_repository, &lock,
 				       LOCK_DIE_ON_ERROR);
-		if (!strcmp(strategy, "ort"))
-			clean = merge_ort_recursive(&o, head, remoteheads->item,
-						    reversed, &result);
-		else
-			clean = merge_recursive(&o, head, remoteheads->item,
-						reversed, &result);
+		clean = merge_ort_recursive(&o, head, remoteheads->item,
+					    reversed, &result);
 		free_commit_list(reversed);
 		strbuf_release(&o.obuf);
 
diff --git a/sequencer.c b/sequencer.c
index b5d91fd3515..8bb49735891 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4319,20 +4319,13 @@ static int do_merge(struct repository *r,
 	o.branch2 = ref_name.buf;
 	o.buffer_output = 2;
 
-	if (!opts->strategy || !strcmp(opts->strategy, "ort")) {
-		/*
-		 * TODO: Should use merge_incore_recursive() and
-		 * merge_switch_to_result(), skipping the call to
-		 * merge_switch_to_result() when we don't actually need to
-		 * update the index and working copy immediately.
-		 */
-		ret = merge_ort_recursive(&o,
-					  head_commit, merge_commit, bases,
-					  &i);
-	} else {
-		ret = merge_recursive(&o, head_commit, merge_commit, bases,
-				      &i);
-	}
+	/*
+	 * TODO: Should use merge_incore_recursive() and
+	 * merge_switch_to_result(), skipping the call to
+	 * merge_switch_to_result() when we don't actually need to
+	 * update the index and working copy immediately.
+	 */
+	ret = merge_ort_recursive(&o, head_commit, merge_commit, bases, &i);
 	if (ret <= 0)
 		fputs(o.obuf.buf, stdout);
 	strbuf_release(&o.obuf);
@@ -4343,7 +4336,7 @@ static int do_merge(struct repository *r,
 		goto leave_merge;
 	}
 	/*
-	 * The return value of merge_recursive() is 1 on clean, and 0 on
+	 * The return value of merge_ort_recursive() is 1 on clean, and 0 on
 	 * unclean merge.
 	 *
 	 * Let's reverse that, so that do_merge() returns 0 upon success and
diff --git a/t/t7615-diff-algo-with-mergy-operations.sh b/t/t7615-diff-algo-with-mergy-operations.sh
index ac5863e788c..5822d02d517 100755
--- a/t/t7615-diff-algo-with-mergy-operations.sh
+++ b/t/t7615-diff-algo-with-mergy-operations.sh
@@ -22,8 +22,6 @@ test_expect_success 'setup' '
 	git tag c2
 '
 
-GIT_TEST_MERGE_ALGORITHM=recursive
-
 test_expect_success 'merge c2 to c1 with recursive merge strategy fails with the current default myers diff algorithm' '
 	git reset --hard c1 &&
 	test_must_fail git merge -s recursive -Xdiff-algorithm=myers c2
-- 
gitgitgadget


  parent reply	other threads:[~2025-03-31 15:51 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 15:51 [PATCH 0/8] Debug merge-recursive.[ch] Elijah Newren via GitGitGadget
2025-03-31 15:51 ` [PATCH 1/8] checkout: replace merge_trees() with merge_ort_nonrecursive() Elijah Newren via GitGitGadget
2025-03-31 15:51 ` [PATCH 2/8] builtin/merge-recursive: switch to using merge_ort_generic() Elijah Newren via GitGitGadget
2025-03-31 15:51 ` [PATCH 3/8] merge-ort: enable diff-algorithms other than histogram Elijah Newren via GitGitGadget
2025-03-31 15:51 ` [PATCH 4/8] sequencer: switch non-recursive merges over to ort Elijah Newren via GitGitGadget
2025-03-31 15:51 ` Elijah Newren via GitGitGadget [this message]
2025-03-31 15:51 ` [PATCH 6/8] merge-recursive.[ch]: thoroughly debug these Elijah Newren via GitGitGadget
2025-03-31 15:51 ` [PATCH 7/8] tests: remove GIT_TEST_MERGE_ALGORITHM and test_expect_merge_algorithm Elijah Newren via GitGitGadget
2025-03-31 17:34   ` Eric Sunshine
2025-03-31 18:14     ` Elijah Newren
2025-03-31 15:51 ` [PATCH 8/8] builtin/{merge,rebase,revert}: remove GIT_TEST_MERGE_ALGORITHM Elijah Newren via GitGitGadget
2025-04-05 22:16 ` [PATCH v2 0/8] Debug merge-recursive.[ch] Elijah Newren via GitGitGadget
2025-04-05 22:16   ` [PATCH v2 1/8] checkout: replace merge_trees() with merge_ort_nonrecursive() Elijah Newren via GitGitGadget
2025-04-05 22:16   ` [PATCH v2 2/8] builtin/merge-recursive: switch to using merge_ort_generic() Elijah Newren via GitGitGadget
2025-04-05 22:16   ` [PATCH v2 3/8] merge-ort: enable diff-algorithms other than histogram Elijah Newren via GitGitGadget
2025-04-05 22:16   ` [PATCH v2 4/8] sequencer: switch non-recursive merges over to ort Elijah Newren via GitGitGadget
2025-04-05 22:16   ` [PATCH v2 5/8] merge, sequencer: switch recursive " Elijah Newren via GitGitGadget
2025-04-05 22:16   ` [PATCH v2 6/8] merge-recursive.[ch]: thoroughly debug these Elijah Newren via GitGitGadget
2025-04-05 22:16   ` [PATCH v2 7/8] tests: remove GIT_TEST_MERGE_ALGORITHM and test_expect_merge_algorithm Elijah Newren via GitGitGadget
2025-04-05 22:16   ` [PATCH v2 8/8] builtin/{merge,rebase,revert}: remove GIT_TEST_MERGE_ALGORITHM Elijah Newren via GitGitGadget
2025-04-07 20:09   ` [PATCH v2 0/8] Debug merge-recursive.[ch] Junio C Hamano
2025-04-07 22:23     ` Elijah Newren
2025-04-08 15:48   ` [PATCH v3 " Elijah Newren via GitGitGadget
2025-04-08 15:48     ` [PATCH v3 1/8] checkout: replace merge_trees() with merge_ort_nonrecursive() Elijah Newren via GitGitGadget
2025-04-08 15:48     ` [PATCH v3 2/8] builtin/merge-recursive: switch to using merge_ort_generic() Elijah Newren via GitGitGadget
2025-04-08 15:48     ` [PATCH v3 3/8] merge-ort: enable diff-algorithms other than histogram Elijah Newren via GitGitGadget
2025-04-08 15:48     ` [PATCH v3 4/8] sequencer: switch non-recursive merges over to ort Elijah Newren via GitGitGadget
2025-04-08 15:48     ` [PATCH v3 5/8] merge, sequencer: switch recursive " Elijah Newren via GitGitGadget
2025-04-08 15:48     ` [PATCH v3 6/8] merge-recursive.[ch]: thoroughly debug these Elijah Newren via GitGitGadget
2025-04-08 15:48     ` [PATCH v3 7/8] tests: remove GIT_TEST_MERGE_ALGORITHM and test_expect_merge_algorithm Elijah Newren via GitGitGadget
2025-04-08 15:48     ` [PATCH v3 8/8] builtin/{merge,rebase,revert}: remove GIT_TEST_MERGE_ALGORITHM Elijah Newren via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91398ffd1e12e42fe9c9233a6ec14c448dea79ae.1743436280.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).