@@ -51,8 +51,65 @@ test_expect_success default '
5151
5252'
5353
54+ test_expect_success ' default (attribute)' '
55+
56+ test_might_fail git config --unset core.whitespace &&
57+ echo "F whitespace" >.gitattributes &&
58+ prepare_output &&
59+
60+ grep Eight error >/dev/null &&
61+ grep HT error >/dev/null &&
62+ grep With error >/dev/null &&
63+ grep Return error >/dev/null &&
64+ grep No normal >/dev/null
65+
66+ '
67+
68+ test_expect_success ' default, tabwidth=10 (attribute)' '
69+
70+ git config core.whitespace "tabwidth=10" &&
71+ echo "F whitespace" >.gitattributes &&
72+ prepare_output &&
73+
74+ grep Eight normal >/dev/null &&
75+ grep HT error >/dev/null &&
76+ grep With error >/dev/null &&
77+ grep Return error >/dev/null &&
78+ grep No normal >/dev/null
79+
80+ '
81+
82+ test_expect_success ' no check (attribute)' '
83+
84+ test_might_fail git config --unset core.whitespace &&
85+ echo "F -whitespace" >.gitattributes &&
86+ prepare_output &&
87+
88+ grep Eight normal >/dev/null &&
89+ grep HT normal >/dev/null &&
90+ grep With normal >/dev/null &&
91+ grep Return normal >/dev/null &&
92+ grep No normal >/dev/null
93+
94+ '
95+
96+ test_expect_success ' no check, tabwidth=10 (attribute), must be irrelevant' '
97+
98+ git config core.whitespace "tabwidth=10" &&
99+ echo "F -whitespace" >.gitattributes &&
100+ prepare_output &&
101+
102+ grep Eight normal >/dev/null &&
103+ grep HT normal >/dev/null &&
104+ grep With normal >/dev/null &&
105+ grep Return normal >/dev/null &&
106+ grep No normal >/dev/null
107+
108+ '
109+
54110test_expect_success ' without -trail' '
55111
112+ rm -f .gitattributes &&
56113 git config core.whitespace -trail &&
57114 prepare_output &&
58115
@@ -134,6 +191,34 @@ test_expect_success 'with indent-non-tab only (attribute)' '
134191
135192'
136193
194+ test_expect_success ' with indent-non-tab only, tabwidth=10' '
195+
196+ rm -f .gitattributes &&
197+ git config core.whitespace indent,tabwidth=10,-trailing,-space &&
198+ prepare_output &&
199+
200+ grep Eight normal >/dev/null &&
201+ grep HT normal >/dev/null &&
202+ grep With normal >/dev/null &&
203+ grep Return normal >/dev/null &&
204+ grep No normal >/dev/null
205+
206+ '
207+
208+ test_expect_success ' with indent-non-tab only, tabwidth=10 (attribute)' '
209+
210+ test_might_fail git config --unset core.whitespace &&
211+ echo "F whitespace=indent,-trailing,-space,tabwidth=10" >.gitattributes &&
212+ prepare_output &&
213+
214+ grep Eight normal >/dev/null &&
215+ grep HT normal >/dev/null &&
216+ grep With normal >/dev/null &&
217+ grep Return normal >/dev/null &&
218+ grep No normal >/dev/null
219+
220+ '
221+
137222test_expect_success ' with cr-at-eol' '
138223
139224 rm -f .gitattributes &&
0 commit comments