@@ -1218,6 +1218,93 @@ test_expect_success 'last one wins: three level vars' '
1218
1218
test_cmp expect actual
1219
1219
'
1220
1220
1221
+ test_expect_success ' old-fashioned settings are case insensitive' '
1222
+ test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" &&
1223
+
1224
+ cat >testConfig_actual <<-EOF &&
1225
+ [V.A]
1226
+ r = value1
1227
+ EOF
1228
+ q_to_tab >testConfig_expect <<-EOF &&
1229
+ [V.A]
1230
+ Qr = value2
1231
+ EOF
1232
+ git config -f testConfig_actual "v.a.r" value2 &&
1233
+ test_cmp testConfig_expect testConfig_actual &&
1234
+
1235
+ cat >testConfig_actual <<-EOF &&
1236
+ [V.A]
1237
+ r = value1
1238
+ EOF
1239
+ q_to_tab >testConfig_expect <<-EOF &&
1240
+ [V.A]
1241
+ QR = value2
1242
+ EOF
1243
+ git config -f testConfig_actual "V.a.R" value2 &&
1244
+ test_cmp testConfig_expect testConfig_actual &&
1245
+
1246
+ cat >testConfig_actual <<-EOF &&
1247
+ [V.A]
1248
+ r = value1
1249
+ EOF
1250
+ q_to_tab >testConfig_expect <<-EOF &&
1251
+ [V.A]
1252
+ r = value1
1253
+ Qr = value2
1254
+ EOF
1255
+ git config -f testConfig_actual "V.A.r" value2 &&
1256
+ test_cmp testConfig_expect testConfig_actual &&
1257
+
1258
+ cat >testConfig_actual <<-EOF &&
1259
+ [V.A]
1260
+ r = value1
1261
+ EOF
1262
+ q_to_tab >testConfig_expect <<-EOF &&
1263
+ [V.A]
1264
+ r = value1
1265
+ Qr = value2
1266
+ EOF
1267
+ git config -f testConfig_actual "v.A.r" value2 &&
1268
+ test_cmp testConfig_expect testConfig_actual
1269
+ '
1270
+
1271
+ test_expect_success ' setting different case sensitive subsections ' '
1272
+ test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" &&
1273
+
1274
+ cat >testConfig_actual <<-EOF &&
1275
+ [V "A"]
1276
+ R = v1
1277
+ [K "E"]
1278
+ Y = v1
1279
+ [a "b"]
1280
+ c = v1
1281
+ [d "e"]
1282
+ f = v1
1283
+ EOF
1284
+ q_to_tab >testConfig_expect <<-EOF &&
1285
+ [V "A"]
1286
+ Qr = v2
1287
+ [K "E"]
1288
+ Qy = v2
1289
+ [a "b"]
1290
+ Qc = v2
1291
+ [d "e"]
1292
+ f = v1
1293
+ [d "E"]
1294
+ Qf = v2
1295
+ EOF
1296
+ # exact match
1297
+ git config -f testConfig_actual a.b.c v2 &&
1298
+ # match section and subsection, key is cased differently.
1299
+ git config -f testConfig_actual K.E.y v2 &&
1300
+ # section and key are matched case insensitive, but subsection needs
1301
+ # to match; When writing out new values only the key is adjusted
1302
+ git config -f testConfig_actual v.A.r v2 &&
1303
+ # subsection is not matched:
1304
+ git config -f testConfig_actual d.E.f v2 &&
1305
+ test_cmp testConfig_expect testConfig_actual
1306
+ '
1307
+
1221
1308
for VAR in a .a a. a.0b a." b c" . a." b c" .0d
1222
1309
do
1223
1310
test_expect_success " git -c $VAR =VAL rejects invalid '$VAR '" '
0 commit comments