@matheusbsbs / matheus-bagliano / commits / aa76ae4905
Fork 0

t4108: demonstrate bug in apply

Currently, apply does not respect the merge.conflictStyle setting. Demonstrate this by making the 'apply with --3way' test case generic and extending it to show that the configuration of merge.conflictStyle = diff3 causes a breakage. Change print_sanitized_conflicted_diff() to also sanitize `|||||||` conflict markers. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Oct 23, 2019 at 16:32 UTC aa76ae4905c28e264f0affc58e36c1db692fa881
1 file changed +11 -2
t/t4108-apply-threeway.sh
+11 -2
@@ -8,7 +8,7 @@ print_sanitized_conflicted_diff () {
8 git diff HEAD >diff.raw &&
9 sed -e '
10 /^index /d
11 - s/^\(+[<>][<>][<>][<>]*\) .*/\1/
11 + s/^\(+[<>|][<>|][<>|][<>|]*\) .*/\1/
12 ' diff.raw
13 }
14
@@ -46,7 +46,7 @@ test_expect_success 'apply without --3way' '
46 git diff-index --exit-code --cached HEAD
47 '
48
49 -test_expect_success 'apply with --3way' '
49 +test_apply_with_3way () {
50 # Merging side should be similar to applying this patch
51 git diff ...side >P.diff &&
52
@@ -67,6 +67,15 @@ test_expect_success 'apply with --3way' '
67 # The result should resemble the corresponding merge
68 test_cmp expect.ls actual.ls &&
69 test_cmp expect.diff actual.diff
70 +}
71 +
72 +test_expect_success 'apply with --3way' '
73 + test_apply_with_3way
74 +'
75 +
76 +test_expect_failure 'apply with --3way with merge.conflictStyle = diff3' '
77 + test_config merge.conflictStyle diff3 &&
78 + test_apply_with_3way
79 '
80
81 test_expect_success 'apply with --3way with rerere enabled' '