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

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 <eyvind.bernhardsen@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Aug 5, 2010 at 06:13 UTC beeeb45493332f38de2a3b58120c5bebb5863577
1 file changed +49 -1
t/t6038-merge-text-auto.sh
+49 -1
@@ -15,7 +15,6 @@ test_description='CRLF merge conflict across text=auto change
15 . ./test-lib.sh
16
17 test_expect_success setup '
18 - git config merge.renormalize true &&
18 git config core.autocrlf false &&
19
20 echo first line | append_cr >file &&
@@ -59,12 +58,19 @@ test_expect_success setup '
58 git checkout master
59 '
60
61 +test_expect_success 'set up fuzz_conflict() helper' '
62 + fuzz_conflict() {
63 + sed -e "s/^\([<>=]......\) .*/\1/" "$@"
64 + }
65 +'
66 +
67 test_expect_success 'Merge after setting text=auto' '
68 cat <<-\EOF >expected &&
69 first line
70 same line
71 EOF
72
73 + git config merge.renormalize true &&
74 git rm -fr . &&
75 rm -f .gitattributes &&
76 git reset --hard a &&
@@ -78,6 +84,7 @@ test_expect_success 'Merge addition of text=auto' '
84 same line
85 EOF
86
87 + git config merge.renormalize true &&
88 git rm -fr . &&
89 rm -f .gitattributes &&
90 git reset --hard b &&
@@ -85,12 +92,51 @@ test_expect_success 'Merge addition of text=auto' '
92 test_cmp expected file
93 '
94
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 +
133 test_expect_failure 'checkout -m after setting text=auto' '
134 cat <<-\EOF >expected &&
135 first line
136 same line
137 EOF
138
139 + git config merge.renormalize true &&
140 git rm -fr . &&
141 rm -f .gitattributes &&
142 git reset --hard initial &&
@@ -105,6 +151,7 @@ test_expect_failure 'checkout -m addition of text=auto' '
151 same line
152 EOF
153
154 + git config merge.renormalize true &&
155 git rm -fr . &&
156 rm -f .gitattributes file &&
157 git reset --hard initial &&
@@ -119,6 +166,7 @@ test_expect_failure 'cherry-pick patch from after text=auto was added' '
166 same line
167 EOF
168
169 + git config merge.renormalize true &&
170 git rm -fr . &&
171 git reset --hard b &&
172 test_must_fail git cherry-pick a >err 2>&1 &&