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

[PATCH v3 3/4] notes: fix merge.conflictstyle handling

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 10, 2023, 21:37 UTC
Message-ID
<20230510213738.505241-4-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/notes.c                    |  3 ++-
 t/t6440-config-conflict-markers.sh | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index d5788352b6..9a9044b50b 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -28,6 +28,7 @@
 #include "notes-utils.h"
 #include "worktree.h"
 #include "write-or-die.h"
+#include "xdiff-interface.h"
 
 static const char * const git_notes_usage[] = {
 	N_("git notes [--ref <notes-ref>] [list [<object>]]"),
@@ -1020,7 +1021,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
 		OPT_END()
 	};
 
-	git_config(git_default_config, NULL);
+	git_config(git_xmerge_config, NULL);
 	argc = parse_options(argc, argv, prefix, options, git_notes_usage,
 			     PARSE_OPT_SUBCOMMAND_OPTIONAL);
 	if (!fn) {
diff --git a/t/t6440-config-conflict-markers.sh b/t/t6440-config-conflict-markers.sh
index cb2ee3ad0a..c51512ced6 100755
--- a/t/t6440-config-conflict-markers.sh
+++ b/t/t6440-config-conflict-markers.sh
@@ -55,4 +55,31 @@ test_expect_success 'merge-tree' '
 	)
 '
 
+test_expect_success 'notes' '
+	test_create_repo notes &&
+	(
+		test_commit initial &&
+
+		git -c core.notesRef=refs/notes/b notes add -m b initial &&
+
+		git update-ref refs/notes/r refs/notes/b &&
+		git -c core.notesRef=refs/notes/r notes add -f -m r initial &&
+
+		git update-ref refs/notes/l refs/notes/b &&
+		git config core.notesRef refs/notes/l &&
+		git notes add -f -m l initial &&
+
+		test_must_fail git notes merge r &&
+		! grep "^|||||||" .git/NOTES_MERGE_WORKTREE/* &&
+
+		git notes merge --abort &&
+		test_must_fail git -c merge.conflictstyle=diff3 notes merge r &&
+		grep "^|||||||" .git/NOTES_MERGE_WORKTREE/* &&
+
+		git notes merge --abort &&
+		test_must_fail git -c merge.conflictstyle=merge notes merge r &&
+		! grep "^|||||||" .git/NOTES_MERGE_WORKTREE/*
+	)
+'
+
 test_done
-- 
2.40.0+fc1
Previous: Felipe Contreras
Message 5 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.