From e40eefba02d684253bc5102eaa921db7ddd21128 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sun, 16 Mar 2025 06:58:55 +0000 Subject: [PATCH 1/5] stash: remove merge-recursive.h include stash was modified to use merge_ort_nonrecursive() instead of merge_recursive_generic() back in commit 874cf2a60444 (stash: apply stash using 'merge_ort_nonrecursive()', 2022-05-10). That makes the inclusion of merge-recursive.h unnecessary. In preparation for the removal of merge-recursive.h, remove the unnecessary include. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- builtin/stash.c | 1 - 1 file changed, 1 deletion(-) diff --git a/builtin/stash.c b/builtin/stash.c index dbaa999cf1..cfbd92852a 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -13,7 +13,6 @@ #include "lockfile.h" #include "cache-tree.h" #include "unpack-trees.h" -#include "merge-recursive.h" #include "merge-ort-wrappers.h" #include "strvec.h" #include "run-command.h" From 9c69ad275e52777e7217d9854c610dc1aad222cc Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sun, 16 Mar 2025 06:58:56 +0000 Subject: [PATCH 2/5] t6423: fix a comment that accidentally reversed two commits The comment describing testcase 13b of t6423 somehow mixed up commits A and B in one paragraph. Fix the references. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- t/t6423-merge-rename-directories.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 94080c65d1..ebf47cdd6b 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -5549,9 +5549,9 @@ test_expect_success '13b(info): messages for transitive rename with conflicted c # Commit A: y/{b,c,d}, x/e # Commit B: z/{b,c,d}, x/e # Expected: y/{b,c,d}, x/e, with info or conflict messages for d -# A: renamed x/d -> z/d; B: renamed z/ -> y/ AND renamed x/d to y/d -# One could argue A had partial knowledge of what was done with -# d and B had full knowledge, but that's a slippery slope as +# B: renamed x/d -> z/d; A: renamed z/ -> y/ AND renamed x/d to y/d +# One could argue B had partial knowledge of what was done with +# d and A had full knowledge, but that's a slippery slope as # shown in testcase 13d. test_setup_13c () { From a373f93370a9c8980f02d24ab06a333cec67f89b Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sun, 16 Mar 2025 06:58:57 +0000 Subject: [PATCH 3/5] t7615: be more explicit about diff algorithm used t7615 is entirely about testing the differences about different diff algorithms, but it doesn't specify any diff algorithm when it is testing myers. Given that we have discussed potentially switching defaults (https://lore.kernel.org/git/xmqqed873vgn.fsf@gitster.g/), it makes sense in tests that are about different diff algorithms to be explicitly about which one is intended to be used in each test. Add that specificity. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- t/t7615-diff-algo-with-mergy-operations.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t7615-diff-algo-with-mergy-operations.sh b/t/t7615-diff-algo-with-mergy-operations.sh index 3b1aad0167..ac5863e788 100755 --- a/t/t7615-diff-algo-with-mergy-operations.sh +++ b/t/t7615-diff-algo-with-mergy-operations.sh @@ -26,7 +26,7 @@ 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 c2 + test_must_fail git merge -s recursive -Xdiff-algorithm=myers c2 ' test_expect_success 'merge c2 to c1 with recursive merge strategy succeeds with -Xdiff-algorithm=histogram' ' @@ -42,7 +42,7 @@ test_expect_success 'merge c2 to c1 with recursive merge strategy succeeds with test_expect_success 'cherry-pick c2 to c1 with recursive merge strategy fails with the current default myers diff algorithm' ' git reset --hard c1 && - test_must_fail git cherry-pick -s recursive c2 + test_must_fail git cherry-pick -s recursive -Xdiff-algorithm=myers c2 ' test_expect_success 'cherry-pick c2 to c1 with recursive merge strategy succeeds with -Xdiff-algorithm=histogram' ' From 5692a46b098adf172c641c02f920589fc33d01a4 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sun, 16 Mar 2025 06:58:58 +0000 Subject: [PATCH 4/5] merge-ort: fix accidental strset<->strintmap Both strset_for_each_entry and strintmap_for_each_entry are macros that evaluate to the same thing, so they are technically interchangeable. However, the intent is that we use the one matching the variable type we are passing. Unfortunately, I somehow mistakenly got one of these wrong in 7bee6c100431 (merge-ort: avoid recursing into directories when we don't need to, 2021-07-16) -- possibly related to the fact that relevant_sources was initially a strset and later refactored into a strintmap. Correct which macro we use. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- merge-ort.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/merge-ort.c b/merge-ort.c index 46e78c3ffa..a12aa213b0 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -1517,8 +1517,8 @@ static int handle_deferred_entries(struct merge_options *opt, struct strintmap copy; /* Loop over the set of paths we need to know rename info for */ - strset_for_each_entry(&renames->relevant_sources[side], - &iter, entry) { + strintmap_for_each_entry(&renames->relevant_sources[side], + &iter, entry) { char *rename_target, *dir, *dir_marker; struct strmap_entry *e; From a18c18b470f108c70717ed22c0ab5b892c6d3683 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sun, 16 Mar 2025 06:58:59 +0000 Subject: [PATCH 5/5] merge-ort: remove extraneous word in comment "is was" -> "was" Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- merge-ort.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/merge-ort.c b/merge-ort.c index a12aa213b0..9efc2285a9 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -3423,9 +3423,9 @@ static int collect_renames(struct merge_options *opt, /* * p->score comes back from diffcore_rename_extended() with - * the similarity of the renamed file. The similarity is - * was used to determine that the two files were related - * and are a rename, which we have already used, but beyond + * the similarity of the renamed file. The similarity was + * used to determine that the two files were related and + * are a rename, which we have already used, but beyond * that we have no use for the similarity. So p->score is * now irrelevant. However, process_renames() will need to * know which side of the merge this rename was associated