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

[PATCH v3 2/4] merge-tree: fix merge.conflictstyle handling

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 10, 2023, 21:37 UTC
Message-ID
<20230510213738.505241-3-felipe.contreras@gmail.com>
In-Reply-To
<20230510213738.505241-1-felipe.contreras@gmail.com>
Currently it's completely ignored.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin/merge-tree.c               |  4 ++++
 t/t6440-config-conflict-markers.sh | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index aa8040c2a6..a98f84634e 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -17,6 +17,8 @@
 #include "merge-blobs.h"
 #include "quote.h"
 #include "tree.h"
+#include "config.h"
+#include "xdiff-interface.h"
 
 static int line_termination = '\n';
 
@@ -628,6 +630,8 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
 	if (argc != expected_remaining_argc)
 		usage_with_options(merge_tree_usage, mt_options);
 
+	git_config(git_xmerge_config, NULL);
+
 	/* Do the relevant type of merge */
 	if (o.mode == MODE_REAL)
 		return real_merge(&o, merge_base, argv[0], argv[1], prefix);
diff --git a/t/t6440-config-conflict-markers.sh b/t/t6440-config-conflict-markers.sh
index 813d7dda9a..cb2ee3ad0a 100755
--- a/t/t6440-config-conflict-markers.sh
+++ b/t/t6440-config-conflict-markers.sh
@@ -34,4 +34,25 @@ test_expect_success 'merge' '
 	)
 '
 
+test_expect_success 'merge-tree' '
+	test_create_repo merge-tree &&
+	(
+		cd merge-tree &&
+
+		test_commit initial initial-file initial &&
+		test_commit r content r &&
+		git reset --hard initial &&
+		test_commit l content l &&
+
+		git merge-tree initial r l >actual &&
+		! grep "^+|||||||" content &&
+
+		git -c merge.conflictstyle=diff3 merge-tree initial r l >actual &&
+		grep "^+|||||||" actual &&
+
+		git -c merge.conflictstyle=merge merge-tree initial r l >actual &&
+		! grep "^+|||||||" content
+	)
+'
+
 test_done
-- 
2.40.0+fc1
Previous: Felipe ContrerasNext: Felipe Contreras
Message 3 of 5 in “Generic conflict style fixes”
  1. 0/4 Generic conflict style fixesFelipe Contreras, May 10, 2023
  2. 1/4 test: add merge style config testFelipe Contreras, May 10, 2023
  3. 2/4 merge-tree: fix merge.conflictstyle handlingFelipe Contreras, May 10, 2023
  4. 4/4 test: document broken merge.conflictStyle handlingFelipe Contreras, May 10, 2023
  5. 3/4 notes: fix merge.conflictstyle handlingFelipe Contreras, May 10, 2023

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.