The switch to diff3 by default got stuck on a tar pit, however that's no reason not to improve the merge.conflictStyle handling. I dropped all the controversial changes and focused only on the obvious improvements. I switched to from the custom fill function to test_write_lines as Eric Sunshine suggested, and used a simpler and stricter grep regex for diff3 markers as Phillip Wood prompted. Felipe Contreras (4): test: add merge style config test merge-tree: fix merge.conflictstyle handling notes: fix merge.conflictstyle handling test: document broken merge.conflictStyle handling builtin/merge-tree.c | 4 + builtin/notes.c | 3 +- t/t6440-config-conflict-markers.sh | 116 +++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100755 t/t6440-config-conflict-markers.sh Range-diff against v1: 1: 118388c313 ! 1: 51351f1a77 test: add merge style config test @@ t/t6440-config-conflict-markers.sh (new) + +. ./test-lib.sh + -+fill () { -+ for i -+ do -+ echo "$i" -+ done -+} -+ +test_expect_success 'merge' ' + test_create_repo merge && + ( + cd merge && + -+ fill 1 2 3 >content && ++ test_write_lines 1 2 3 >content && + git add content && + git commit -m base && + @@ t/t6440-config-conflict-markers.sh (new) + git commit -a -m left && + + test_must_fail git merge r && -+ ! grep -E "\|+" content && ++ ! grep "^|||||||" content && + + git reset --hard && + test_must_fail git -c merge.conflictstyle=diff3 merge r && -+ grep -E "\|+" content && ++ grep "^|||||||" content && + + git reset --hard && + test_must_fail git -c merge.conflictstyle=merge merge r && -+ ! grep -E "\|+" content ++ ! grep "^|||||||" content + ) +' + 2: 697f2a2a5c ! 2: 1fccf561ed merge-tree: fix merge.conflictstyle handling @@ t/t6440-config-conflict-markers.sh: test_expect_success 'merge' ' + test_commit l content l && + + git merge-tree initial r l >actual && -+ ! grep -E "\|+" actual && ++ ! grep "^+|||||||" content && + + git -c merge.conflictstyle=diff3 merge-tree initial r l >actual && -+ grep -E "\|+" actual && ++ grep "^+|||||||" actual && + + git -c merge.conflictstyle=merge merge-tree initial r l >actual && -+ ! grep -E "\|+" actual ++ ! grep "^+|||||||" content + ) +' + 3: 56a20f41a4 ! 3: 3bb872e3cd notes: fix merge.conflictstyle handling @@ t/t6440-config-conflict-markers.sh: test_expect_success 'merge-tree' ' + git notes add -f -m l initial && + + test_must_fail git notes merge r && -+ ! grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* && ++ ! grep "^|||||||" .git/NOTES_MERGE_WORKTREE/* && + + git notes merge --abort && + test_must_fail git -c merge.conflictstyle=diff3 notes merge r && -+ grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* && ++ grep "^|||||||" .git/NOTES_MERGE_WORKTREE/* && + + git notes merge --abort && + test_must_fail git -c merge.conflictstyle=merge notes merge r && -+ ! grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* ++ ! grep "^|||||||" .git/NOTES_MERGE_WORKTREE/* + ) +' + 4: adce598754 < -: ---------- checkout: fix merge.conflictstyle handling 5: a4ddbbc44a < -: ---------- xdiff: rename XDL_MERGE_STYLE_DIFF3 6: c3e0940dab < -: ---------- xdiff: simplify style assignments 7: 6415e53345 < -: ---------- xdiff: make diff3 the default conflictStyle -: ---------- > 4: a767bc68e6 test: document broken merge.conflictStyle handling -- 2.32.0