Skip to content

Commit aa76ae4

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9580620 commit aa76ae4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

t/t4108-apply-threeway.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ print_sanitized_conflicted_diff () {
88
git diff HEAD >diff.raw &&
99
sed -e '
1010
/^index /d
11-
s/^\(+[<>][<>][<>][<>]*\) .*/\1/
11+
s/^\(+[<>|][<>|][<>|][<>|]*\) .*/\1/
1212
' diff.raw
1313
}
1414

@@ -46,7 +46,7 @@ test_expect_success 'apply without --3way' '
4646
git diff-index --exit-code --cached HEAD
4747
'
4848

49-
test_expect_success 'apply with --3way' '
49+
test_apply_with_3way () {
5050
# Merging side should be similar to applying this patch
5151
git diff ...side >P.diff &&
5252

@@ -67,6 +67,15 @@ test_expect_success 'apply with --3way' '
6767
# The result should resemble the corresponding merge
6868
test_cmp expect.ls actual.ls &&
6969
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
7079
'
7180

7281
test_expect_success 'apply with --3way with rerere enabled' '

0 commit comments

Comments
 (0)