From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>, Taylor Blau <me@ttaylorr.com>,
Elijah Newren <newren@gmail.com>,
Elijah Newren <newren@gmail.com>,
Elijah Newren <newren@gmail.com>
Subject: [PATCH v2 6/6] am: switch from merge_recursive_generic() to merge_ort_generic()
Date: Thu, 13 Mar 2025 02:46:41 +0000 [thread overview]
Message-ID: <3f4b74eb3b934c62edb23b69db7460e3e0b44877.1741834001.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1875.v2.git.1741834001.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
Switch from merge-recursive to merge-ort. Adjust the following
testcases due to the switch:
* t4151: This test left an untracked file in the way of the merge.
merge-recursive could only sometimes tell when untracked files were
in the way, and by the time it discovers others, it has already made
too many changes to back out of the merge. So, instead of writing the
results to e.g. 'file1' it would instead write them to
'file1~branch1'. This is confusing for users, because they might not
notice 'file1~branch1' and accidentally add and commit 'file1'.
In contrast, merge-ort correctly notices the file in the way before
making any changes and aborts. Since this test didn't care about the
file in the way, just remove it before calling git-am.
* t4255: Usage of merge-ort allows us to change two known failures into
successes.
* t6427: As noted a few commits ago, the choice of conflict label for
diff3 markers for the ancestor commit was previously handled by
merge-recursive.c rather than by callers. Since that has now changed,
`git am` needs to specify that label. Although the previous conflict
label ("constructed merge base") was already fairly somewhat slanted
towards `git am`, let's use wording more along the lines of the
related command-line flag from `git apply` and function involved to
tie it more closely to `git am`.
Signed-off-by: Elijah Newren <newren@gmail.com>
---
builtin/am.c | 5 +++--
t/t4151-am-abort.sh | 2 +-
t/t4255-am-submodule.sh | 1 -
t/t6427-diff3-conflict-markers.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/am.c b/builtin/am.c
index 2921bb89ef1..3b61bd4c333 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -31,7 +31,7 @@
#include "preload-index.h"
#include "sequencer.h"
#include "revision.h"
-#include "merge-recursive.h"
+#include "merge-ort-wrappers.h"
#include "log-tree.h"
#include "notes-utils.h"
#include "rerere.h"
@@ -1638,12 +1638,13 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
o.branch1 = "HEAD";
their_tree_name = xstrfmt("%.*s", linelen(state->msg), state->msg);
o.branch2 = their_tree_name;
+ o.ancestor = "constructed fake ancestor";
o.detect_directory_renames = MERGE_DIRECTORY_RENAMES_NONE;
if (state->quiet)
o.verbosity = 0;
- if (merge_recursive_generic(&o, &our_tree, &their_tree, 1, bases, &result)) {
+ if (merge_ort_generic(&o, &our_tree, &their_tree, 1, bases, &result)) {
repo_rerere(the_repository, state->allow_rerere_autoupdate);
free(their_tree_name);
return error(_("Failed to merge in the changes."));
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index edb38da7010..8e1ecf8a685 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -112,7 +112,7 @@ test_expect_success 'am --abort will keep dirty index intact' '
test_expect_success 'am -3 stops on conflict on unborn branch' '
git checkout -f --orphan orphan &&
git reset &&
- rm -f otherfile-4 &&
+ rm -f file-1 otherfile-4 &&
test_must_fail git am -3 0003-*.patch &&
test 2 -eq $(git ls-files -u | wc -l) &&
test 4 = "$(cat otherfile-4)"
diff --git a/t/t4255-am-submodule.sh b/t/t4255-am-submodule.sh
index a7ba08f728c..e6679a01b44 100755
--- a/t/t4255-am-submodule.sh
+++ b/t/t4255-am-submodule.sh
@@ -19,7 +19,6 @@ am_3way () {
$2 git am --3way patch
}
-KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
test_submodule_switch_func "am_3way"
test_expect_success 'setup diff.submodule' '
diff --git a/t/t6427-diff3-conflict-markers.sh b/t/t6427-diff3-conflict-markers.sh
index dd5fe6a4021..57569c4f4bd 100755
--- a/t/t6427-diff3-conflict-markers.sh
+++ b/t/t6427-diff3-conflict-markers.sh
@@ -207,7 +207,7 @@ test_expect_success 'rebase --apply describes fake ancestor base' '
cd rebase &&
git rebase --abort &&
test_must_fail git -c merge.conflictstyle=diff3 rebase --apply main &&
- grep "||||||| constructed merge base" file
+ grep "||||||| constructed fake ancestor" file
)
'
--
gitgitgadget
next prev parent reply other threads:[~2025-03-13 2:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 15:48 [PATCH 0/3] Small new merge-ort features, prepping for deletion of merge-recursive.[ch] Elijah Newren via GitGitGadget
2025-03-07 15:48 ` [PATCH 1/3] merge-ort: add new merge_ort_generic() function Elijah Newren via GitGitGadget
2025-03-12 8:06 ` Patrick Steinhardt
2025-03-12 20:00 ` Taylor Blau
2025-03-12 21:39 ` Elijah Newren
2025-03-07 15:48 ` [PATCH 2/3] merge-ort: allow rename detection to be disabled Elijah Newren via GitGitGadget
2025-03-12 8:06 ` Patrick Steinhardt
2025-03-12 20:02 ` Taylor Blau
2025-03-12 21:40 ` Elijah Newren
2025-03-12 21:50 ` Taylor Blau
2025-03-13 5:25 ` Jeff King
2025-03-07 15:48 ` [PATCH 3/3] merge-ort: support having merge verbosity be set to 0 Elijah Newren via GitGitGadget
2025-03-12 20:03 ` Taylor Blau
2025-03-12 21:44 ` Elijah Newren
2025-03-12 21:50 ` Taylor Blau
2025-03-12 8:06 ` [PATCH 0/3] Small new merge-ort features, prepping for deletion of merge-recursive.[ch] Patrick Steinhardt
2025-03-12 20:05 ` Taylor Blau
2025-03-13 2:46 ` [PATCH v2 0/6] " Elijah Newren via GitGitGadget
2025-03-13 2:46 ` [PATCH v2 1/6] merge-ort: add new merge_ort_generic() function Elijah Newren via GitGitGadget
2025-03-13 2:46 ` [PATCH v2 2/6] merge-ort: allow rename detection to be disabled Elijah Newren via GitGitGadget
2025-03-13 2:46 ` [PATCH v2 3/6] merge-ort: support having merge verbosity be set to 0 Elijah Newren via GitGitGadget
2025-03-13 2:46 ` [PATCH v2 4/6] t3650: document bug when directory renames are turned off Johannes Schindelin via GitGitGadget
2025-03-13 2:46 ` [PATCH v2 5/6] merge-ort: fix merge.directoryRenames=false Elijah Newren via GitGitGadget
2025-03-13 2:46 ` Elijah Newren via GitGitGadget [this message]
2025-03-17 21:25 ` [PATCH v2 0/6] Small new merge-ort features, prepping for deletion of merge-recursive.[ch] Taylor Blau
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=3f4b74eb3b934c62edb23b69db7460e3e0b44877.1741834001.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=newren@gmail.com \
--cc=ps@pks.im \
/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).