9
path="$1"
10
expect="$2"
11
12
- git check-attr test -- "$path" >actual 2>err &&
12
+ git $3 check-attr test -- "$path" >actual 2>err &&
13
echo "$path: test: $2" >expect &&
14
test_cmp expect actual &&
15
test_line_count = 0 err
27
echo "onoff test -test"
28
echo "offon -test test"
29
echo "no notest"
30
+ echo "A/e/F test=A/e/F"
31
) >.gitattributes &&
32
(
33
echo "g test=a/g" &&
94
95
'
96
97
+test_expect_success 'attribute matching is case sensitive when core.ignorecase=0' '
98
+
99
+ test_must_fail attr_check F f "-c core.ignorecase=0" &&
100
+ test_must_fail attr_check a/F f "-c core.ignorecase=0" &&
101
+ test_must_fail attr_check a/c/F f "-c core.ignorecase=0" &&
102
+ test_must_fail attr_check a/G a/g "-c core.ignorecase=0" &&
103
+ test_must_fail attr_check a/B/g a/b/g "-c core.ignorecase=0" &&
104
+ test_must_fail attr_check a/b/G a/b/g "-c core.ignorecase=0" &&
105
+ test_must_fail attr_check a/b/H a/b/h "-c core.ignorecase=0" &&
106
+ test_must_fail attr_check a/b/D/g "a/b/d/*" "-c core.ignorecase=0" &&
107
+ test_must_fail attr_check oNoFf unset "-c core.ignorecase=0" &&
108
+ test_must_fail attr_check oFfOn set "-c core.ignorecase=0" &&
109
+ attr_check NO unspecified "-c core.ignorecase=0" &&
110
+ test_must_fail attr_check a/b/D/NO "a/b/d/*" "-c core.ignorecase=0" &&
111
+ attr_check a/b/d/YES a/b/d/* "-c core.ignorecase=0" &&
112
+ test_must_fail attr_check a/E/f "A/e/F" "-c core.ignorecase=0"
113
+
114
+'
115
+
116
+test_expect_success 'attribute matching is case insensitive when core.ignorecase=1' '
117
+
118
+ attr_check F f "-c core.ignorecase=1" &&
119
+ attr_check a/F f "-c core.ignorecase=1" &&
120
+ attr_check a/c/F f "-c core.ignorecase=1" &&
121
+ attr_check a/G a/g "-c core.ignorecase=1" &&
122
+ attr_check a/B/g a/b/g "-c core.ignorecase=1" &&
123
+ attr_check a/b/G a/b/g "-c core.ignorecase=1" &&
124
+ attr_check a/b/H a/b/h "-c core.ignorecase=1" &&
125
+ attr_check a/b/D/g "a/b/d/*" "-c core.ignorecase=1" &&
126
+ attr_check oNoFf unset "-c core.ignorecase=1" &&
127
+ attr_check oFfOn set "-c core.ignorecase=1" &&
128
+ attr_check NO unspecified "-c core.ignorecase=1" &&
129
+ attr_check a/b/D/NO "a/b/d/*" "-c core.ignorecase=1" &&
130
+ attr_check a/b/d/YES unspecified "-c core.ignorecase=1" &&
131
+ attr_check a/E/f "A/e/F" "-c core.ignorecase=1"
132
+
133
+'
134
+
135
+test_expect_success 'check whether FS is case-insensitive' '
136
+ mkdir junk &&
137
+ echo good >junk/CamelCase &&
138
+ echo bad >junk/camelcase &&
139
+ if test "$(cat junk/CamelCase)" != good
140
+ then
141
+ test_set_prereq CASE_INSENSITIVE_FS
142
+ fi
143
+'
144
+
145
+test_expect_success CASE_INSENSITIVE_FS 'additional case insensitivity tests' '
146
+ test_must_fail attr_check a/B/D/g "a/b/d/*" "-c core.ignorecase=0" &&
147
+ test_must_fail attr_check A/B/D/NO "a/b/d/*" "-c core.ignorecase=0" &&
148
+ attr_check A/b/h a/b/h "-c core.ignorecase=1" &&
149
+ attr_check a/B/D/g "a/b/d/*" "-c core.ignorecase=1" &&
150
+ attr_check A/B/D/NO "a/b/d/*" "-c core.ignorecase=1"
151
+'
152
+
153
test_expect_success 'unnormalized paths' '
154
155
attr_check ./f f &&