1187
cookieFile = /tmp/user.txt
1188
[http "https://averylonguser@example.com/"]
1189
cookieFile = /tmp/averylonguser.txt
1190
+ [http "https://preceding.example.com"]
1191
+ cookieFile = /tmp/preceding.txt
1192
+ [http "https://*.example.com"]
1193
+ cookieFile = /tmp/wildcard.txt
1194
+ [http "https://*.example.com/wildcardwithsubdomain"]
1195
+ cookieFile = /tmp/wildcardwithsubdomain.txt
1196
+ [http "https://trailing.example.com"]
1197
+ cookieFile = /tmp/trailing.txt
1198
+ [http "https://user@*.example.com/"]
1199
+ cookieFile = /tmp/wildcardwithuser.txt
1200
+ [http "https://sub.example.com/"]
1201
+ cookieFile = /tmp/sub.txt
1202
EOF
1203
1204
echo http.cookiefile /tmp/root.txt >expect &&
1219
1220
echo http.cookiefile /tmp/subdirectory.txt >expect &&
1221
git config --get-urlmatch HTTP https://averylonguser@example.com/subdirectory >actual &&
1222
+ test_cmp expect actual &&
1223
+
1224
+ echo http.cookiefile /tmp/preceding.txt >expect &&
1225
+ git config --get-urlmatch HTTP https://preceding.example.com >actual &&
1226
+ test_cmp expect actual &&
1227
+
1228
+ echo http.cookiefile /tmp/wildcard.txt >expect &&
1229
+ git config --get-urlmatch HTTP https://wildcard.example.com >actual &&
1230
+ test_cmp expect actual &&
1231
+
1232
+ echo http.cookiefile /tmp/sub.txt >expect &&
1233
+ git config --get-urlmatch HTTP https://sub.example.com/wildcardwithsubdomain >actual &&
1234
+ test_cmp expect actual &&
1235
+
1236
+ echo http.cookiefile /tmp/trailing.txt >expect &&
1237
+ git config --get-urlmatch HTTP https://trailing.example.com >actual &&
1238
+ test_cmp expect actual &&
1239
+
1240
+ echo http.cookiefile /tmp/sub.txt >expect &&
1241
+ git config --get-urlmatch HTTP https://user@sub.example.com >actual &&
1242
+ test_cmp expect actual
1243
+'
1244
+
1245
+test_expect_success 'urlmatch with wildcard' '
1246
+ cat >.git/config <<-\EOF &&
1247
+ [http]
1248
+ sslVerify
1249
+ [http "https://*.example.com"]
1250
+ sslVerify = false
1251
+ cookieFile = /tmp/cookie.txt
1252
+ EOF
1253
+
1254
+ test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
1255
+ test_must_be_empty actual &&
1256
+
1257
+ echo true >expect &&
1258
+ git config --bool --get-urlmatch http.SSLverify https://example.com >actual &&
1259
+ test_cmp expect actual &&
1260
+
1261
+ echo true >expect &&
1262
+ git config --bool --get-urlmatch http.SSLverify https://good-example.com >actual &&
1263
+ test_cmp expect actual &&
1264
+
1265
+ echo true >expect &&
1266
+ git config --bool --get-urlmatch http.sslverify https://deep.nested.example.com >actual &&
1267
+ test_cmp expect actual &&
1268
+
1269
+ echo false >expect &&
1270
+ git config --bool --get-urlmatch http.sslverify https://good.example.com >actual &&
1271
+ test_cmp expect actual &&
1272
+
1273
+ {
1274
+ echo http.cookiefile /tmp/cookie.txt &&
1275
+ echo http.sslverify false
1276
+ } >expect &&
1277
+ git config --get-urlmatch HTTP https://good.example.com >actual &&
1278
+ test_cmp expect actual &&
1279
+
1280
+ echo http.sslverify >expect &&
1281
+ git config --get-urlmatch HTTP https://more.example.com.au >actual &&
1282
test_cmp expect actual
1283
'
1284