merge, sequencer: switch recursive merges over to ort

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
main
Elijah Newren 2025-04-08 15:48:39 +00:00 committed by Junio C Hamano
parent f7ca9bbea6
commit 75cd9ae05f
3 changed files with 10 additions and 24 deletions

View File

@ -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);


View File

@ -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

View File

@ -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