Skip to content

Commit beeeb45

Browse files
jrngitster
authored andcommitted
t6038 (merge.renormalize): check that it can be turned off
An unusual sort of person (not me) may even enjoy the conflicts from line-ending changes. But more importantly, it is useful to document that behavior so we can more easily notice if it changes in an uncontrolled way while no one is watching. Cc: Eyvind Bernhardsen <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d347cee commit beeeb45

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

t/t6038-merge-text-auto.sh

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ test_description='CRLF merge conflict across text=auto change
1515
. ./test-lib.sh
1616

1717
test_expect_success setup '
18-
git config merge.renormalize true &&
1918
git config core.autocrlf false &&
2019
2120
echo first line | append_cr >file &&
@@ -59,12 +58,19 @@ test_expect_success setup '
5958
git checkout master
6059
'
6160

61+
test_expect_success 'set up fuzz_conflict() helper' '
62+
fuzz_conflict() {
63+
sed -e "s/^\([<>=]......\) .*/\1/" "$@"
64+
}
65+
'
66+
6267
test_expect_success 'Merge after setting text=auto' '
6368
cat <<-\EOF >expected &&
6469
first line
6570
same line
6671
EOF
6772
73+
git config merge.renormalize true &&
6874
git rm -fr . &&
6975
rm -f .gitattributes &&
7076
git reset --hard a &&
@@ -78,19 +84,59 @@ test_expect_success 'Merge addition of text=auto' '
7884
same line
7985
EOF
8086
87+
git config merge.renormalize true &&
8188
git rm -fr . &&
8289
rm -f .gitattributes &&
8390
git reset --hard b &&
8491
git merge a &&
8592
test_cmp expected file
8693
'
8794

95+
test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
96+
q_to_cr <<-\EOF >expected &&
97+
<<<<<<<
98+
first line
99+
same line
100+
=======
101+
first lineQ
102+
same lineQ
103+
>>>>>>>
104+
EOF
105+
106+
git config merge.renormalize false &&
107+
rm -f .gitattributes &&
108+
git reset --hard a &&
109+
test_must_fail git merge b &&
110+
fuzz_conflict file >file.fuzzy &&
111+
test_cmp expected file.fuzzy
112+
'
113+
114+
test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' '
115+
q_to_cr <<-\EOF >expected &&
116+
<<<<<<<
117+
first lineQ
118+
same lineQ
119+
=======
120+
first line
121+
same line
122+
>>>>>>>
123+
EOF
124+
125+
git config merge.renormalize false &&
126+
rm -f .gitattributes &&
127+
git reset --hard b &&
128+
test_must_fail git merge a &&
129+
fuzz_conflict file >file.fuzzy &&
130+
test_cmp expected file.fuzzy
131+
'
132+
88133
test_expect_failure 'checkout -m after setting text=auto' '
89134
cat <<-\EOF >expected &&
90135
first line
91136
same line
92137
EOF
93138
139+
git config merge.renormalize true &&
94140
git rm -fr . &&
95141
rm -f .gitattributes &&
96142
git reset --hard initial &&
@@ -105,6 +151,7 @@ test_expect_failure 'checkout -m addition of text=auto' '
105151
same line
106152
EOF
107153
154+
git config merge.renormalize true &&
108155
git rm -fr . &&
109156
rm -f .gitattributes file &&
110157
git reset --hard initial &&
@@ -119,6 +166,7 @@ test_expect_failure 'cherry-pick patch from after text=auto was added' '
119166
same line
120167
EOF
121168
169+
git config merge.renormalize true &&
122170
git rm -fr . &&
123171
git reset --hard b &&
124172
test_must_fail git cherry-pick a >err 2>&1 &&

0 commit comments

Comments
 (0)